[Rcpp-devel] Error using Rcpp under windows xp

Dirk Eddelbuettel edd at debian.org
Sat Dec 4 17:08:55 CET 2010


On 4 December 2010 at 23:42, 陈峥 wrote:
| Hi,
| 
| 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:
| http://dirk.eddelbuettel.com/code/rcpp.examples.html
| 
| #include<Rcpp.h>
| 
| 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
| 'RcppResultSet::RcppResultSet()'
| ...
| undefined reference to 'double*
| Rcpp::internal::r_vector_start<14,double>(SEXPREC*)'
| collect2: ld returned 1 exit status
| 
| Can someone help me out?


I suspect you need to read Question 2.8 of the Rcpp FAQ at 

   http://dirk.eddelbuettel.com/code/rcpp/Rcpp-FAQ.pdf

or on the CRAN pages for Rcpp.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list