系统规格:
当我尝试编译在R中使用C++ 11的函数(通过Rcpp)时,我继续收到错误 - 由于某种原因,g ++无法识别-std=c++11选项.
此示例取自Rcpp帮助文件(它不包含任何特定于C++ 11的内容,但可以显示我的问题).如果我尝试运行:
require( Rcpp )
Sys.setenv( "PKG_CXXFLAGS"="-std=c++11" )
cppFunction(plugins=c("cpp11"), '
int useCpp11() {
int x = 10;
return x;
}')
Run Code Online (Sandbox Code Playgroud)
我明白了:
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [file61239328ae6.o] Error 1
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -std=c++11 -fPIC -g -O2 -c file61239328ae6.cpp -o file61239328ae6.o
Error in sourceCpp(code = …Run Code Online (Sandbox Code Playgroud)