0

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)

1

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
dimitris93
  • 4,155
  • 11
  • 50
  • 86
  • There is a link to download my project from Dropbox above the image of my question. – dimitris93 Mar 28 '16 at 16:17
  • It was pointed out to me that the version I am using is obsolete and I will try to use the latest version of SpatiaLite and not the "amalgamation" version. I managed to make the code compile with a few changes on the `spatialite.c`, such as using `#define OMIT_GEOS` etc., and also changing a variable like this `const char spatialiteversion[] = "3.0.1";`. I will l try to compile the *latest* SpatiaLite library instead, and I will post here how I did it in Clion. – dimitris93 Mar 28 '16 at 18:52

0 Answers0