【发布时间】:2015-12-18 07:41:35
【问题描述】:
我正在尝试在 RStudio 的 Windows 上使用 Rcpp。我有 R 版本 3.2.3 并且我已经安装了 Rcpp 包。问题是我无法调用通过 CPP 代码定义的任何函数。我尝试了以下方法(从网上的一个例子中挑选)。
body <- '
NumericVector xx(x);
return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));'
add <- cxxfunction(signature(x = "numeric"), body, plugin = "Rcpp")
这会给出以下警告,但会成功完成执行。
cygwin warning:
MS-DOS style path detected: C:/R/R-32~1.3/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R/R-32~1.3/etc/x64/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
当我尝试使用上述功能时,
x <- 1
y <- 2
res <- add(c(x, y))
我收到以下错误:
R Session Aborted
R encountered a fatal error.
The session was terminated.
有什么建议吗?我使用 Rcpp 运行的任何代码都会发生同样的“致命错误”。
【问题讨论】:
-
您安装了哪个版本的 Rtools?您使用的是哪个 Rcpp 版本?
-
RTools 版本为 33,Rcpp 版本为 0.12.2
-
我的建议是使用 Rtools32。 Rtools 33 不稳定。