我正在做Hadley Wickhams的基本Rcpp教程,第一行代码让我感到困惑:
> 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:cygwinbin;C:Program FilesJavajdk1.7.0_21bin;C:RR-3.0.1bin;C:Rtoolsbin;C:Rtoolsgcc-4.6.3bin;C:Rtoolsgcc-4.6.3bin64;C:Rtoolsgcc-4.6.3i686-w64-mingw32bin;C:Program Files (x86)Gitbin;C:Program FilesMiKTeX 2.9miktexbinx64;C:Rtoolsgcc-4.6.3bin
我在Path变量中没有任何空格,它应该需要查找。
不要在R构建中使用Cygwin(就像我们都喜欢bash
一样),或者如果必须,请确保Rtools
路径条目优先。
由于没有Rtools(基于MinGW)就无法在Windows上构建R,我经常用MSys来补充它。