spatial index - Undefined reference to libspatialindex functions in C++ -
i'm getting started libspatialindex. ran through instructions install @ http://libspatialindex.github.io/install.html , installed ok on ubuntu following commands (except couldn't find autogen.sh mentions).
./configure make sudo make install
then made simple program test follows (based on https://github.com/libspatialindex/libspatialindex/wiki/simple-tutorial )
#include <spatialindex/capi/sidx_api.h> using namespace spatialindex; int main(int argc, char* argv[]) { char* pszversion = sidx_version(); }
and compile follows:
g++ -lspatialindex spatial.cpp -o spatial
and gives me error:
/tmp/ccack3p4.o: in function `main': spatial.cpp:(.text+0xa): undefined reference `sidx_version' collect2: ld returned 1 exit status
i've tried many different things such using cmake instead , installing different folder no luck. ideas?
edit:
added namespace spatialindex above , tried following, still not luck:
g++ -c -o spatial.o spatial.cpp g++ -o spatial spatial.o -lspatialindex -lm
the problem linking phase. library correctly found because compiler dont throws alert(s) of kind of situation (i made test now). a
> nm libspatialindex |grep sidx_version
for checking symbol existence in library using. may libspatialindex_c instead?
Comments
Post a Comment