首页 > 解决方案 > 在 R 中获取 cpp 代码时,在构建共享库时发生错误 1

问题描述

我需要使用一些c++代码来加快一些计算。为了做到这一点,我需要 Rtools。

我去了:https : //cran.r-project.org/bin/windows/Rtools/ 并安装了最新的稳定版本(Rtools35.exe(推荐))。安装似乎很好。

然后我find_rtools从 package启动devtools。在像这样的初始错误之后Rtools 与 R 版本 3.5.1 不兼容吗?由于那个答案,我设法解决了它。

现在find_rtools返回TRUE

然后我尝试获取我的 cpp 代码,但仍然会弹出此错误:

C:/Rtools/mingw_64/bin/g++ -I"C:/Users/MARCO~1.FUM/DOCUME~1/R/R-35~1.0/include" -DNDEBUG -I"C:/Users/marco. fumagalli/Documents/R/R-3.5.0/library/Rcpp/include" -I"C:/Users/marco.fumagalli/CustomerNavigation/src/features" -O2 -Wall -mtune=generic -c bDist.cpp - o bDist.o 10 [main] make 20472 child_copy: stack write copy failed, 0x65ABA0..0x660000, done 0, windows pid 20472, Win32 error 5 482 [main] make 20472 fork: child 14912 - pid 14912, exitval 0x103, errno 11 制作:fork:资源暂时不可用 sourceCpp 中的错误(“src/features/bDist.cpp”):构建共享库时发生错误 1。尝试网址

然后它会弹出一个窗口说我需要一个 c++ 编译器(?!)。

正如此处指出的那样,Rcpp 找不到 Rtools:“在构建共享库时发生错误 1”我已经将建议的 bin 路径添加到 PATH 中。

我的 R 版本信息

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.0                         
year           2018                        
month          04                          
day            23                          
svn rev        74626                       
language       R                           
version.string R version 3.5.0 (2018-04-23)
nickname       Joy in Playing  

我在 Windows 10 上。

谢谢

标签: rrtools

解决方案


推荐阅读