Compilation Error using ANN Approximate nearest neighbour library

From: Travis Stewart (m0f14_at_unb.ca)
Date: 06/09/04


Date: Wed, 09 Jun 2004 11:01:53 -0300

Hi,
I am not very familiar with C++ so the problems I am having might be
simple and I just cannot see them or I am totally unaware of why something
would be incorrect. Anyway, I'm using the ANN approximate nearest
neighbour libraries written by David Mount and Sunil Arya. In the ANN.h
file there is a comment describing how the data types used to represent
the coordinates and distances between points can be modified by the user.
For my use of library it would be most convientent to use a float instead
of the default double type. When I compile the program initially with the
original settings I do not get errors, but when I modify the header file
for the float type I get the error:

[stewart@samples]$ g++ ann_sample.cc -I/home/stewart/ANN/include
-L/home/stewart/ANN/lib -lANN -Wno-deprecated
/tmp/ccrhNdym.o(.text+0x123): In function `main':
: undefined reference to `annAllocPt(int, float)'
/tmp/ccrhNdym.o(.text+0x1e0): In function `main':
: undefined reference to `ANNkd_tree::ANNkd_tree[in-charge](float**, int,
: int, i
nt, ANNsplitRule)'
collect2: ld returned 1 exit status

The program I am using and the modified header file (the types of
ANNcoord and ANNdist are now float, and ANN_DIST_INF is now MAXFLOAT) are
rather long so I have links to each.

http://v5o5jotqkgfu3btr91t7w5fhzedjaoaz8igl.unbf.ca/~m0f14/ANN.h
http://v5o5jotqkgfu3btr91t7w5fhzedjaoaz8igl.unbf.ca/~m0f14/ann_sample.cc

Thanks for any help,
Travis