[Rcpp-devel] Error using Rcpp under windows xp

陈峥 randomcz at gmail.com
Sat Dec 4 16:42:03 CET 2010


I am a newbie to Rcpp packages, and got problems in having basic set-ups for
Rcpp under windows xp. Here is the list I have done.

1) installed Rtools and have no problem in compiling .c file and also no
problem in using 'incline' package.
2) installed Rcpp packages
3) set enviroment variables 'path' to make
C:\Program Files\R\R-2.12.0\library\Rcpp\include\

The sample C++ code I used is from the original website:


RcppExport SEXP newRcppVectorExample(SEXP vector) {

    Rcpp::NumericVector orig(vector);                  // keep a copy (as
the classic
version does)
    Rcpp::NumericVector vec(orig.size());              // create a target
vector of the
same size

    // we could query size via
    //   int n = vec.size();
    // and loop over the vector, but using the STL is so much nicer
    // so we use a STL transform() algorithm on each element
    std::transform(orig.begin(), orig.end(), vec.begin(), sqrt);

    Rcpp::Pairlist res(Rcpp::Named( "result", vec),
                       Rcpp::Named( "original", orig));

    return res;

I got bunch of error messages like:
test.o:test.cpp:(.test+0x141): undefined reference to
undefined reference to 'double*
collect2: ld returned 1 exit status

Can someone help me out?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20101204/8a2b9ffb/attachment.htm>

More information about the Rcpp-devel mailing list