windows 机器上 Rstudio 中 Rcpp 的致命错误

Fatal Error for Rcpp in Rstudio on windows machine

我有 R Studio(当然还有 R),我打算使用 Rcpp package.I 我正在使用 windows 机器。

  1. 我安装了 R 工具。该文件夹位于 C:\Rtool
  2. 我在控制面板->系统->高级系统设置->环境变量中更改了我的 PATH 并添加了 2 个新的 PATH s C:\Rtools\mingw_32\i686-w64-mingw32\bin 和 C:\Rtools\bin 每个都在PATH 列表的顶部
  3. 我重启了电脑
  4. 在 rstudio 中启动了一个新的 C++ 脚本
  5. 使用 library() 加载了 rcpp 包
  6. 运行 预先存在的代码 (timesTwo) 通过点击水平栏中的 Source 按钮。

然后我收到一条错误消息

The application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information

还会弹出一个警告,说明

R Session Aborted. R encountered a fatal error. The session was terminated.

通过运行 library(rcpp) 和 sessionInfo() 我得到版本信息

R version 3.3.1 (2016-06-21)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Malaysia.1252  LC_CTYPE=English_Malaysia.1252   
[3] LC_MONETARY=English_Malaysia.1252 LC_NUMERIC=C                     
[5] LC_TIME=English_Malaysia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Rcpp_0.12.6

loaded via a namespace (and not attached):
[1] tools_3.3.1

谁能告诉我哪里出了问题,我该如何解决?

两个问题:

  1. 您正在 64 位 OS
  2. 上使用 32 位版本的 R
  3. Rtools 的路径设置不正确。

路径应该有:

c:\Rtools\bin;
c:\Rtools\mingw_32\bin;

有关正确安装 Rtools 的更多帮助,请参阅本指南:

http://thecoatlessprofessor.com/programming/rcpp/install-rtools-for-rcpp/

我在 32 位 OS 和 Windows 7 上遇到了完全相同的问题。我通过使用早期版本的 R 解决了它:R 3.2.5

这是 Windows 上 RStudio 和 R 3.3.x 之间的不良交互,原因是与 RStudio + 用于在 Windows 上构建 R 的新编译器工具链的不良交互.

有几个解决方案:

  1. 安装 RStudio 预览版:https://www.rstudio.com/products/rstudio/download/preview/

  2. 切换到R的64位版本,

  3. 回滚到 R 3.2.x.