I have a cpp file which I am trying to compile with sourceCpp() from RStudio. It includes Rcpp.h, all the necessary STL stuff and "using namespace Rcpp;".
Then it has several function declarations (not exported to R), the function that should be exported to R, and finally the definitions of the declared functions.
This is what I get when I try to compile:
g++ -m32 -I"C:/PROGRA~1/R/R-30~1.2/include" -DNDEBUG -I"C:/Users/Michelle/Documents/R/win-library/3.0/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c RW_FastSwap.cpp -o RW_FastSwap.o
RW_FastSwap.cpp: In function 'SEXPREC* sourceCpp_27691_fastswap(SEXP, SEXP, SEXP, SEXP, SEXP)':
RW_FastSwap.cpp:459:9: error: '__result' was not declared in this scope
make: *** [RW_FastSwap.o] Error 1
Error in Rcpp::sourceCpp("C:/Users/Michelle/Desktop/Google Drive/FastSwap/RW_FastSwap.cpp") :
Error 1 occurred building shared library.
That line number is 15 lines more than the last line of the cpp file, i.e. the last line of the cpp file is 444. I've made sure that the type of the result returned from the exported function matches the return type of the function.
Any guidance on fixing this will be greatly appreciated.
.ofile and try again? - doctorlovesourceCpp(..., verbose=TRUE)? - Kevin Ushey