我正在使用使用MinGW的Clion IDE。我正在关注these instructions,从页面的最底部开始:"最简单的方法:根本没有库..." 来编译 sample.c 即可。我还必须下载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})
我的项目(dropbox link)
我必须将sample.c
的前几行更改为#define SPATIALITE_AMALGAMATION
,并在包含的文件前添加/headers
:
#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
编译错误:
C:\Users\Shiro\ClionProjects\Thesis\somedir\spatialite.c:102:20:
fatal error: geos_c.h: No such file or directory #include <geos_c.h>
^
以下是spatialite.c:102:20
:
#ifndef OMIT_GEOS /* including GEOS */
#include <geos_c.h>
#endif