[geos-devel] using geos C Api

Sandro Santilli strk at keybit.net
Fri Oct 10 09:36:42 PDT 2014


On Fri, Oct 10, 2014 at 05:59:35PM +0200, Rémi Cura wrote:
> Hello,
> trying to use Geos C Api in a  Cpp program.
> The Cpp programm uses CMake.
> 
> Apparently the easy way to incorporate GEOS is by copying the QGIS solution.
> I copy the FindGEOS.cmake file
> <https://raw.githubusercontent.com/qgis/QGIS/master/cmake/FindGEOS.cmake>
> then ad the path to it in CMakeList.txt
>     set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
> 
> then using the regular
>   FIND_PACKAGE(GEOS REQUIRED)
> fills GEOS_LIBRARY and GEOS_INCLUDE_DIR.
> 
> Then I add GEOS LIBRARY has a target for link :
> TARGET_LINK_LIBRARIES(simple_snapping.bin ${CERES_LIBRARIES}
> ${GEOS_LIBRARY})
> 
> 
> After that I'm stuck,
> If I try to use Geos function I get an error by
> ld :
> " geometry_function.cc:-1: error: undefined reference to
> `geos::io::WKTReader::WKTReader()'"
> 
> Anybody has an idea of how to fix this?

Is geos::io::WKTReader::WKTReader used by your geometry_function.cc ?
That's the C++ API, not the C one.

--strk;


More information about the geos-devel mailing list