我在Windows 7上使用R 2.15.1,並在運行以下R代碼時收到錯誤消息。有人幫我嗎?內聯和Rcpp包的錯誤
> library(inline)
>
> if(require(Rcpp)){
+ fx <- cxxfunction(signature(x = "integer", y = "numeric") , '
+ return wrap(as<int>(x) * as<double>(y)) ;
+ ', plugin = "Rcpp")
+ }
Loading required package: Rcpp
cygwin warning:
MS-DOS style path detected: C:/R/R-215~1.1/etc/i386/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R/R-215~1.1/etc/i386/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
Syntax error: "(" unexpected (expecting "fi")
make: *** [file11a82c84184d.dll] Error 2
ERROR(s) during compilation: source code errors or compiler configuration errors!
Program source:
1:
2: // includes from the plugin
3:
4: #include <Rcpp.h>
5:
6:
7: #ifndef BEGIN_RCPP
8: #define BEGIN_RCPP
9: #endif
10:
11: #ifndef END_RCPP
12: #define END_RCPP
13: #endif
14:
15: using namespace Rcpp;
16:
17:
18: // user includes
19:
20:
21: // declarations
22: extern "C" {
23: SEXP file11a82c84184d(SEXP x, SEXP y) ;
24: }
25:
26: // definition
27:
28: SEXP file11a82c84184d(SEXP x, SEXP y){
29: BEGIN_RCPP
30:
31: return wrap(as<int>(x) * as<double>(y)) ;
32:
33: END_RCPP
34: }
35:
36:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! cygwin warning:
MS-DOS style path detected: C:/R/R-215~1.1/etc/i386/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R/R-215~1.1/etc/i386/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
Syntax error: "(" unexpected (expecting "fi")
make: *** [file11a82c84184d.dll] Error 2
In addition: Warning message:
running command 'C:/R/R-2.15.1/bin/i386/R CMD SHLIB file11a82c84184d.cpp 2> file11a82c84184d.cpp.err.txt' had status 1
>
除了Dirk的回答下面,你可以關注這個帖子,作者有問題。 http://www.r-bloggers.com/installing-rcpp-on-windows-7-for-r-and-c-integration/ –
這是一個令人費解的帖子。在許多教程中解釋瞭如何在Windows上安裝R的編譯器。總之,不要與Cygwin混合使用。 –