Reputation: 7846
I am trying to run a test function but I am getting a compile error:
library(Rcpp)
library(inline)
testfun = cxxfunction(
signature(x="numeric", i="integer"),
body = '
NumericVector xx(x);
int ii = as<int>(i);
xx = xx * ii;
return( xx );
', plugin="Rcpp")
testfun(1:5, 3)
Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! In addition: Warning message: running command 'C:/PROGRA~1/R/R-215~1.1/bin/x64/R CMD SHLIB filede44a566900.cpp 2> filede44a566900.cpp.err.txt' had status 1
I would be grateful for your help. I am using windows 7, R2.15.1, 64 bit
Upvotes: 1
Views: 1927
Reputation: 368181
Try adding verbose=TRUE
as you seem to have a simple setup issue -- maybe your PATH is not correct.
Your code is correct and runs just fine here under Linux (where no additional gymnastics is needed as there is on Windows).
Your slightly edited / indented example as copied from my Emacs ESS buffer:
R> library(inline)
R>
R> testfun <- cxxfunction(signature(x="numeric", i="integer"), body = '
+ NumericVector xx(x);
+ int ii = as<int>(i);
+ xx = xx * ii;
+ return( xx );
+ ', plugin="Rcpp")
R>
R> testfun(1:5, 3)
[1] 3 6 9 12 15
R>
Upvotes: 1