[Rcpp-devel] installing Rcpp on windows
Dirk Eddelbuettel
edd at debian.org
Wed Aug 24 14:44:13 CEST 2011
Hi Jeffrey,
On 24 August 2011 at 13:08, Jeffrey Pollock wrote:
| Hello,
|
| I'm trying to get Rcpp to work on my machine running Windows 7 64 bit but I'm
| not having much luck!
|
| I've reinstalled R in: C:\opt\R-2.13.1
| and have: C:\Rtools\MinGW64
| my path variables are set as: C:\Rtools\bin;C:\Rtools\perl\bin;C:\Rtools\
| MinGW64\bin;C:\opt\R-2.13.1\bin\x64;C:\Program Files\Java\jdk1.6.0_25\bin;C:\
| Program Files\TortoiseSVN\bin;%JAVA_HOME%\bin;%MAVEN_HOME%\bin
|
| Trying some examples from the help pdf I get the following error, can anyone
| help?
|
| > library(inline)
| > library(Rcpp)
| > src <- '
| + Rcpp::NumericVectorxa(a);
| + Rcpp::NumericVectorxb(b);
You are lacking critical spaces:
Rcpp::NumericVector xa(a);
Rcpp::NumericVector xb(b);
Rcpp::NumericVector is the type, xa is the variable of that type and a is the
SEXP used to init it.
| + intn_xa=xa.size(),n_xb=xb.size();
| +
| + Rcpp::NumericVectorxab(n_xa+n_xb-1);
| + for(inti=0;i<n_xa;i++)
| + for(intj=0;j<n_xb;j++)
| + xab[i+j]+=xa[i]*xb[j];
| + returnxab;
| + '
| > fun <- cxxfunction(signature(a = "numeric", b = "numeric"), src, plugin =
| "Rcpp")
| cygwin warning:
| MS-DOS style path detected: C:/opt/R-213~1.1/etc/x64/Makeconf
| Preferred POSIX equivalent is: /cygdrive/c/opt/R-213~1.1/etc/x64/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
| file788a7664.cpp: In function 'SEXPREC* file788a7664(SEXPREC*, SEXPREC*)':
| file788a7664.cpp:31:1: error: 'NumericVectorxa' is not a member of 'Rcpp'
| file788a7664.cpp:32:1: error: 'NumericVectorxb' is not a member of 'Rcpp'
The error was quite clear: unknown type.
Maybe trying the examples in the examples/ directory is easier as you may
avoid copy and paste errors?
Dirk
| file788a7664.cpp:33:1: error: 'intn_xa' was not declared in this scope
| file788a7664.cpp:33:9: error: 'xa' was not declared in this scope
| file788a7664.cpp:33:19: error: 'n_xb' was not declared in this scope
| file788a7664.cpp:33:24: error: 'xb' was not declared in this scope
| file788a7664.cpp:35:1: error: 'NumericVectorxab' is not a member of 'Rcpp'
| file788a7664.cpp:35:24: error: 'n_xa' was not declared in this scope
| file788a7664.cpp:36:5: error: 'inti' was not declared in this scope
| file788a7664.cpp:36:12: error: 'i' was not declared in this scope
| file788a7664.cpp:37:6: error: 'intj' was not declared in this scope
| file788a7664.cpp:37:13: error: 'j' was not declared in this scope
| file788a7664.cpp:38:3: error: 'xab' was not declared in this scope
| file788a7664.cpp:39:1: error: 'returnxab' was not declared in this scope
| make: *** [file788a7664.o] Error 1
|
| 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 file788a7664( SEXP a, SEXP b) ;
| 24: }
| 25:
| 26: // definition
| 27:
| 28: SEXP file788a7664( SEXP a, SEXP b ){
| 29: BEGIN_RCPP
| 30:
| 31: Rcpp::NumericVectorxa(a);
| 32: Rcpp::NumericVectorxb(b);
| 33: intn_xa=xa.size(),n_xb=xb.size();
| 34:
| 35: Rcpp::NumericVectorxab(n_xa+n_xb-1);
| 36: for(inti=0;i<n_xa;i++)
| 37: for(intj=0;j<n_xb;j++)
| 38: xab[i+j]+=xa[i]*xb[j];
| 39: returnxab;
| 40:
| 41: END_RCPP
| 42: }
| 43:
| 44:
| 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:/opt/R-213~1.1/etc/x64/Makeconf
| Preferred POSIX equivalent is: /cygdrive/c/opt/R-213~1.1/etc/x64/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
| file788a7664.cpp: In function 'SEXPREC* file788a7664(SEXPREC*, SEXPREC*)':
| file788a7664.cpp:31:1: error: 'NumericVectorxa' is not a member of 'Rcpp'
| file788a7664.cpp:32:1: error: 'NumericVectorxb' is not a member of 'Rcpp'
| file788a7664.cpp:33:1: error: 'intn_xa' was not declared in this scope
| file788a7664.cpp:33:9: error: 'xa' was not declared in this scope
| file788a7664.cpp:33:19: error: 'n_xb' was not declared in this scope
| file788a7664.cpp:33:24: error: 'xb' was not declared in this scope
| file788a7664.cpp:35:1: error: 'NumericVectorxab' is not a member of 'Rcpp'
| fil
| In addition: Warning message:
| running command 'C:/opt/R-2.13.1/bin/x64/R CMD SHLIB file788a7664.cpp 2>
| file788a7664.cpp.err.txt' had status 1
|
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Two new Rcpp master classes for R and C++ integration scheduled for
New York (Sep 24) and San Francisco (Oct 8), more details are at
http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10
http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php
More information about the Rcpp-devel
mailing list