[R] Rcpp cpp11 and R CMD build
Edwin van Leeuwen
edwinvanl at gmail.com
Wed Jun 24 17:07:22 CEST 2015
Hi all,
I've just started using Rcpp and am trying to get cpp11 support working. As
suggested I added [[Rcpp:plugins(cpp11)]] to my source file and a test
function:
// [[Rcpp::export]]
int useCpp11() {
auto x = 10;
return x;
}
This works fine when using:
sourceCpp(filename)
from R, but I would like to be able to compile the package from the command
line.
R CMD build mypackage
fails with the following error:
R CMD build ../fluEvidenceSynthesis
* checking for file ‘../fluEvidenceSynthesis/DESCRIPTION’ ... OK
* preparing ‘fluEvidenceSynthesis’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to process help pages
-----------------------------------
* installing *source* package ‘fluEvidenceSynthesis’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG
-I"/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include"
-I"/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include" -fpic -g
-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o
RcppExports.o
g++ -I/usr/share/R/include -DNDEBUG
-I"/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include"
-I"/home/edwin/R/x86_64-pc-linux-gnu-library/3.2/BH/include" -fpic -g
-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -D_FORTIFY_SOURCE=2 -g -c rcpp_hello_world.cpp -o
rcpp_hello_world.o
rcpp_hello_world.cpp: In function ‘int useCpp11()’:
rcpp_hello_world.cpp:33:10: error: ‘x’ does not name a type
auto x = 10;
^
rcpp_hello_world.cpp:34:12: error: ‘x’ was not declared in this scope
return x;
^
make: *** [rcpp_hello_world.o] Error 1
ERROR: compilation failed for package ‘fluEvidenceSynthesis’
* removing ‘/tmp/RtmpWdUduu/Rinst2b601aa285e9/fluEvidenceSynthesis’
-----------------------------------
ERROR: package installation failed
Any help appreciated.
Cheers, Edwin
[[alternative HTML version deleted]]
More information about the R-help
mailing list