[R] linking other C++ libraries

Samuel Kemp sam.kemp2 at ntlworld.com
Thu Feb 26 09:55:31 CET 2004


Hi,

I have written a little C++ program, which uses a third party library 
called ANN (approximate nearest neighbours)....

#include "/home/sekemp/ann_0.2/include/ANN/ANN.h"

I have tried R CMD SHLIB ann.h myProgram.cc, although this compiles when 
I load it into R I get the following message..

dyn.load("/home/sekemp/ann_0.2/ann.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) :
        unable to load shared library "/home/sekemp/ann_0.2/GammaTest.so":
  /home/sekemp/ann_0.2/GammaTest.so: undefined symbol: 
_ZN10ANNkd_treeC1EPPdiii12ANNsplitRule

I get the same error when I dyn.load the myProgram.so aswell.

There is nothing wrong with the ann library as I have used it directly 
in C++ using the compiler-linker thingy....

g++ myProgram.cc -I/home/sekemp/ann_0.2/include 
-L/home/sekemp/ann_0.2/lib -lANN

Does anyone have any ideas?

Cheers,

Sam.




More information about the R-help mailing list