[Rcpp-devel] finding an undefined symbol

Douglas Bates bates at stat.wisc.edu
Thu Nov 4 22:02:07 CET 2010


On Thu, Nov 4, 2010 at 3:40 PM, Andrew Redd <amredd at gmail.com> wrote:
> Figured it out.  The definition for data3 is in a namespace, so it
> could not find the member functions.
> -Andrew

Good. Now on to fame and fortune, I hope.

> On Thu, Nov 4, 2010 at 2:26 PM, Andrew Redd <amredd at gmail.com> wrote:
>> Thanks for the post.  The data3 class is defined with
>> ---
>> #include <Rcpp.h>
>> #include "types.h" //defines ivec, tvec, idxvec, as vectors and
>> numeric as double
>> class data3{
>> public:
>> data3();
>> void initPat(tvec, tvec);
>> void initAug(ivec, ivec, tvec);
>> void initSwabs(idxvec, ivec, tvec);
>> void setParameters(numeric, numeric, numeric);
>> numeric augmentedLogLikelihood();
>> numeric dataLogLikelihood();
>> };
>> RCPP_MODULE(GPU_BAYES){
>> using namespace Rcpp;
>> class_<data3>("data3")
>> .method("initPat",&data3::initPat)
>> .method("initAug",&data3::initAug)
>> .method("initSwabs",&data3::initSwabs)
>> .method("setParameters", &data3::setParameters);
>> }
>> ---
>> There is no initSwabs with only one parameter, is that what this is looking for?
>>
>> -Andrew
>>
>>
>>
>>
>> On Thu, Nov 4, 2010 at 8:44 AM, Douglas Bates <bates at stat.wisc.edu> wrote:
>>>
>>> On Wed, Nov 3, 2010 at 2:22 PM, Andrew Redd <amredd at gmail.com> wrote:
>>> > I'm writing a rather complicated package using CUDA and Rcpp.  I have
>>> > everything compile and link ok, but when loading I get a
>>> >> "unable to load shared object ..."
>>> >> "... undefined symbol:  _ZN5data39initSwabsESt6vector..."
>>> > Does anyone have any advice how to fix this and/or figure out what exactly
>>> > the problem is?
>>>
>>> First you need to demangle the name.  On Linux systems there is a
>>> utility called c++filt which, for this symbol shows
>>>
>>> $ echo _ZN5data39initSwabsESt6vector | c++filt
>>> data3::initSwabs(std::vector)
>>>
>>> The most likely cause of the problem is that you have the CUDA package
>>> headers in the -I list when you compile but not the library in the -L
>>> list when linking.
>>
>


More information about the Rcpp-devel mailing list