I am using Clion IDE which uses MinGW. I am following these instructions, from the far bottom of the page: "Simplest approach: no libs at all..." to compile sample.c. I also had to download libspatialite-amalgamation-3.0.1.zip
CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
project(spatialitetest)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c99 -Wall -Wextra -Wunused -DSPATIALITE_AMALGAMATION -DOMIT_GEOS=1 -DOMIT_PROJ=1 -DOMIT_ICONV=1 -DOMIT_GEOCALLBACKS=1")
set(CMAKE_EXE_LINKER_FLAGS -static)
set(SOURCE_FILES
headers/spatialite/gaiaaux.h
headers/spatialite/gaiaexif.h
headers/spatialite/gaiageo.h
headers/spatialite/gg_advanced.h
headers/spatialite/gg_const.h
headers/spatialite/gg_core.h
headers/spatialite/gg_dynamic.h
headers/spatialite/gg_formats.h
headers/spatialite/gg_mbr.h
headers/spatialite/gg_structs.h
headers/spatialite/spatialite.h
headers/spatialite/sqlite3.h
headers/spatialite/sqlite3ext.h
headers/spatialite.h
spatialite.c
sqlite3.c
sample.c)
add_executable(spatialitetest ${SOURCE_FILES})
My project (dropbox link)
I had to change the first couple of lines of sample.c
to #define SPATIALITE_AMALGAMATION
and add /headers
in front of the file included:
#define SPATIALITE_AMALGAMATION =1
#ifdef SPATIALITE_AMALGAMATION
#include "headers/spatialite/sqlite3.h"
#else
#include "headers/sqlite3.h"
#endif
#ifndef SPATIALITE_EXTENSION
#include "headers/spatialite.h"
#endif
Compilation error:
C:\Users\Shiro\ClionProjects\Thesis\somedir\spatialite.c:102:20:
fatal error: geos_c.h: No such file or directory #include <geos_c.h>
^
Here is what is at spatialite.c:102:20
:
#ifndef OMIT_GEOS /* including GEOS */
#include <geos_c.h>
#endif