I think you’ve got the architecture wrong. You should think of spatialite as a plugin to sqlite.
Starting with compiling in parts of spatialite is the wrong approach.
Instead, use a built version of spatialite, and make sure your sqlite can load the module. If you don’t know what I mean, start with using sqlite command line and a spatialite tutorial. Then realise that your big C++ project is just a replacement for the command line part.
The only hard part is making sure that the dependencies (geos, proj, etc) are in the library load path. How you do that is up to you.
Brad
SELECT spatialite_version();
bye Sandro
Getting tripped up on the basics. I'm using the tutorial here on loading spatialite in sqlite3.exe https://www.gaia-gis.it/gaia-sins/spatialite-tutorial-2.3.1.html#t2.1I installed OSGeo4W64 and located dlls and libs of the mentioned dependencies of spatialite from http://www.gaia-gis.it/gaia-sins/mingw64_how_to.html#libspatialiteso libiconv, libproj, libgeos, FreeXL dlls and libs and headers, plus mod_spatialite.dll , spatialite.dll, sqlite3.dll, and libs and headers. Not sure what to do with them yet.
Warning
This document is obsolete and contains outdated information. It's still available only to preserve full historical record.
The updated documentation supporting recent versions of SpatiaLite is now published at the following URLs:
Tutorials: https://www.gaia-gis.it/fossil/libspatialite/wiki?name=misc-docs
Cookbook: http://www.gaia-gis.it/gaia-sins/spatialite-cookbook/index.html
Back to the tutorial. I have init_spatialite-2.2.sql as my database from a different spatialite tutorial. So in cmd I go to a folder with sqlite3.exe, sqlite3.dll, and init_spatialite-2.2.sql and runsqlite3 init_spatialite-2.2.sql
I noticed the SQLite version from OSGeo4W64 is 3.17.0. (not sure if this is recent enough, hopefully it is)
In general, getting the paths right is usually the hardest part on using spatialite in larger projects. It depends on what you already have set up for library paths, and the deployment scenario.
I’m curious: if you can’t load the module, what do you think static linking is going to do?
Brad