I'm just getting started with libspatialindex. I ran through the instructions to install and it installed ok on ubuntu with the following commands (except I couldn't find autogen.sh which it mentions).
./configure
make
sudo make install
then I made a very simple program to test it as follows (based on this)
#include <spatialindex/capi/sidx_api.h>
using namespace SpatialIndex;
int main(int argc, char* argv[])
{
char* pszVersion = SIDX_Version();
}
and compile as follows:
g++ -lspatialindex spatial.cpp -o spatial
and it gives me the error:
/tmp/ccACK3p4.o: In function `main':
spatial.cpp:(.text+0xa): undefined reference to `SIDX_Version'
collect2: ld returned 1 exit status
I've tried many different things such as using cmake instead and installing it a different folder but no luck. Any ideas?
EDIT:
Added the namespace SpatialIndex above and I also tried the following, but still not luck:
g++ -c -o spatial.o spatial.cpp
g++ -o spatial spatial.o -lspatialindex -lm
The problem is about linking phase. The library is correctly found because the compiler dont throws alert(s) of that kind of situation (I just made a test now). do a
> nm libspatialindex |grep SIDX_Version
for checking the symbol existence in the library you are using. May be libspatialindex_c instead?