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.
Samuel Kemp wrote:> 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? >Looks like C++ name mangling. Did you wrap your code in extern "C" {}? Regards, Sundar