1

我已经在 R-Studio 中使用 Rcpp 成功构建了自己的包。但是,在 Windows 控制台中构建包时,有一些错误消息抱怨文件丢失R.h.

我设置pathR_Home环境

SET PATH=D:\RTools\gcc-4.6.3\bin;D:\R3\bin;D:\RTools\bin;
SET R_HOME=D:\R3\

构建命令是

R CMD INSTALL  --byte-compile --build mypkg

以下是编译错误消息:

g++ -m32 -I"/include" -DNDEBUG    -I"D:/R3/library/Rcpp/include" -I"d:
/RCompile/CRANpkg/extralibs64/local/include"     -O2 -Wall  -mtune=core2 -c Rcpp
Exports.cpp -o RcppExports.o
In file included from D:/R3/library/Rcpp/include/Rcpp.h:27:0,
                 from RcppExports.cpp:4:
D:/R3/library/Rcpp/include/RcppCommon.h:35:15: fatal error: R.h: No su
ch file or directory
compilation terminated.
4

1 回答 1

0

R.h正如错误所说,您缺少一个 include for 。

如果你看看你的编译行,语句

 -I"/include"

相对于您R_HOMED:/R3

你需要检查你的设置,不知何故你混淆了 R 使用正确的包含目录。Rcpp 在 Windows 上构建得很好,你甚至可以通过将你的包提交到win-builder服务来检查。

于 2013-09-01T13:51:17.440 回答