我在做Hadley Wickhams basic Rcpp Tutorial,第一行代码让我感到难过:
> library(Rcpp)
> cppFunction('
+ int add(int x, int y, int z) {
+ int sum = x + y + z;
+ return sum;
+ }'
+ )
g++ -m64 -I"C:/R/R-30~1.1/include" -DNDEBUG -I"C:/Users/Michael/R/win-library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c file1dc033292fcb.cpp -o file1dc033292fcb.o make: sh.exe: Command not found make: *** [file1dc033292fcb.o] Error 127
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
Error 1 occurred building shared library.
make
和sh.exe
都在我的路径中,我可以在命令提示符中使用它们。我甚至可以从命令提示符调用sh
并在该子进程中使用make
。我使用的是Windows 7,64位。
我的道路:
C:\cygwin\bin;C:\Program Files\Java\jdk1.7.0_21\bin;C:\R\R-3.0.1\bin;C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Rtools\gcc-4.6.3\bin64;C:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin;C:\Program Files (x86)\Git\bin;C:\Program Files\MiKTeX 2.9\miktex\bin\x64;C:\Rtools\gcc-4.6.3\bin
我在Path变量中没有任何空格需要查找。
答案 0 :(得分:2)
不要对R版本使用Cygwin(尽管我们都喜欢bash
),或者如果必须,请确保Rtools
路径条目优先。
由于你不能在没有Rtools(基于MinGW)的Windows上构建R,我经常用MSys补充它。