How to use Rcpp with TDM-gcc 4.8.1?

与世无争的帅哥 提交于 2020-01-15 08:57:13

问题


I'm using R 3.0.2 under Windows 7 (32bit) and has TDM-GCC-32 (gcc (tdm-2) 4.8.1) in the path.

When I try to use cppFunction, I get some error:

library(inline)
library(Rcpp)
src <- '
SEXP hellofun(){
 std::vector<std::string> s;
  s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
}'
hello_fun <- cppFunction(src)

Error message:

Error in inDL(x, as.logical(local), as.logical(now), ...) (from file1c8c8c929f5.cpp.R#1) : 
  unable to load shared object 'C:/Users/ssss11/AppData/Local/Temp/RtmpeywSmo/sourcecpp_1c8c47543253/sourceCpp_60750.dll':
  LoadLibrary failure:  Invalid access to memory location

However when I run example(cfuntion), it succeeds.

library(inline)
example(cfunction)

How to solve this problem?


回答1:


I have no idea what TDM-GCC-32 (gcc (tdm-2) 4.8.1) may be -- but our documentation repeatedly stresses that one and only one compiler is support on Windows: the one that comes with the version of Rtools corresponding to your R version.

Now, 'TDM-gcc-32' may well be feature compatible, but if you want to use it you probably have to rebuild your entire R stack (ie R itself, all packages, ...) with it.

Sot it might be best to wait for R Core / CRAN to update Rtools to a version newer than gcc-4.6.*



来源:https://stackoverflow.com/questions/21355022/how-to-use-rcpp-with-tdm-gcc-4-8-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!