Hi Edwin, If you look at the build output you will notice that the C++11 compiler flag is not being used. I just created a small package using Rcpp11 and your function and it worked without a problem. I can't give you a specific reason without seeing your package but there are some possibilities I would guess right away.
1. Make sure you are 'LinkingTo' Rcpp11 in your DESCRIPTION 2. Unless you are using some custom Makevars file, you should set 'SystemRequirements: C++11' in your DESCRIPTION Charles On Wed, Jun 24, 2015 at 10:07 AM, Edwin van Leeuwen <edwinv...@gmail.com> wrote: > 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]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.