[Rcpp-devel] Compilation error

Mattias Nyström Mattias.Nystrom at srh.slu.se
Thu Jan 7 13:20:02 CET 2010


I've just started with Rcpp. When I compile my file mattias.cpp, using: "R CMD SHLIB mattias.cpp", I get the error below. The source code of the file mattias.cpp is also written below. What can the problem be?

Source code of mattias.cpp:
#include <Rcpp.h>
SEXP firstfunction(SEXP nvec, SEXP ivec, SEXP svec, SEXP nmat)
                             SEXP rl=R_NilValue;
                             RcppVector<double> nv(nvec);
                             RcppVector<int> iv(ivec);
                             RcppStringVector sv(svec);
                             RcppMatrix<double> nm(nmat);

                             return rl;

The compilation error:
g++ -I"C:/PROGRA~1/R/R-210~1.0/include"        -O2 -Wall  -c mattias.cpp -o mattias.o
mattias.cpp: In function 'SEXPREC* firstfunction(SEXPREC*, SEXPREC*, SEXPREC*, SEXPREC*)':
mattias.cpp:9: warning: control reaches end of non-void function
g++ -shared -s -o mattias.dll tmp.def mattias.o -LC:/PROGRA~1/R/R-210~1.0/bin -lR
mattias.o:mattias.cpp:(.text+0xc0): undefined reference to `RcppVector<double>::RcppVector(SEXPREC*)'
mattias.o:mattias.cpp:(.text+0xd2): undefined reference to `RcppVector<int>::RcppVector(SEXPREC*)'
mattias.o:mattias.cpp:(.text+0xe4): undefined reference to `RcppStringVector::RcppStringVector(SEXPREC*)'
mattias.o:mattias.cpp:(.text+0xfd): undefined reference to `RcppMatrix<double>::RcppMatrix(SEXPREC*)'
mattias.o:mattias.cpp:(.text+0x10f): undefined reference to `RcppStringVector::~RcppStringVector()'
mattias.o:mattias.cpp:(.text+0x142): undefined reference to `RcppStringVector::~RcppStringVector()'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100107/c6174b6a/attachment.htm 

More information about the Rcpp-devel mailing list