I am running into a wall getting my system to work with rcpp and inline.
Following Dirk's advice on stackoverflow, I hope someone is able to help
me.
My steps were to install MinGW 32 bit first, then installing Rtools, I
disabled MinGW's entry in the PATH.
I am trying to get the following code to work:
library(Rcpp)
library(inline)
body <- '
NumericVector xx(x);
return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));'
add <- cxxfunction(signature(x = "numeric"), body, plugin = "Rcpp",
verbose=T)
x <- 1
y <- 2
res <- add(c(x, y))
res
I get the following error messages:
>> setting environment variables:
PKG_LIBS = C:/Users/Owe/Documents/R/win-library/2.15/Rcpp/lib/x64/libRcpp.a
>> LinkingTo : Rcpp
CLINK_CPPFLAGS = -I"C:/Users/Owe/Documents/R/win-library/2.15/Rcpp/include"
>> 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 file10bc7da0783e( SEXP x) ;
24 : }
25 :
26 : // definition
27 :
28 : SEXP file10bc7da0783e( SEXP x ){
29 : BEGIN_RCPP
30 :
31 : NumericVector xx(x);
32 : return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));
33 : END_RCPP
34 : }
35 :
36 :
Compilation argument:
C:/R_curr/R_2_15_0/bin/x64/R CMD SHLIB file10bc7da0783e.cpp 2>
file10bc7da0783e.cpp.err.txt
g++ -m64 -I"C:/R_curr/R_2_15_0/include" -DNDEBUG
-I"C:/Users/Owe/Documents/R/win-library/2.15/Rcpp/include"
-I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2
-c file10bc7da0783e.cpp -o file10bc7da0783e.o
g++ -m64 -shared -s -static-libgcc -o file10bc7da0783e.dll tmp.def
file10bc7da0783e.o
C:/Users/Owe/Documents/R/win-library/2.15/Rcpp/lib/x64/libRcpp.a
-Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64
-Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/R_curr/R_2_15_0/bin/x64 -lR
cygwin warning:
MS-DOS style path detected: C:/R_curr/R_2_15_0/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R_curr/R_2_15_0/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
Cannot export Rcpp::Vector<14>::update(): symbol not defined
Cannot export Rcpp::Vector<14>::~Vector(): symbol not defined
Cannot export Rcpp::Vector<14>::~Vector(): symbol not defined
Cannot export typeinfo for Rcpp::VectorBase<14, true, Rcpp::Vector<14> >:
symbol not defined
Cannot export typeinfo for Rcpp::Vector<14>: symbol not defined
Cannot export typeinfo for Rcpp::traits::expands_to_logical__impl<14>: symbol
not defined
Cannot export typeinfo for Rcpp::RObject: symbol not defined
Cannot export typeinfo for Rcpp::internal::eval_methods<14>: symbol not defined
Cannot export typeinfo for std::exception: symbol not defined
Cannot export typeinfo name for Rcpp::VectorBase<14, true, Rcpp::Vector<14> >:
symbol not defined
Cannot export typeinfo name for Rcpp::Vector<14>: symbol not defined
Cannot export typeinfo name for Rcpp::traits::expands_to_logical__impl<14>:
symbol not defined
Cannot export typeinfo name for Rcpp::RObject: symbol not defined
Cannot export typeinfo name for Rcpp::internal::eval_methods<14>: symbol not
defined
Cannot export typeinfo name for std::exception: symbol not defined
Cannot export vtable for Rcpp::Vector<14>: symbol not defined
Cannot export _file10bc7da0783e: symbol not defined
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text+0x1a4): undefined reference to
`SEXPREC* Rcpp::internal::r_true_cast<14>(SEXPREC*)'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text+0x1c9): undefined reference to
`Rcpp::RObject::setSEXP(SEXPREC*)'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text+0x244): undefined reference to
`double* Rcpp::internal::r_vector_start<14, double>(SEXPREC*)'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text+0x27c): undefined reference to
`Rcpp::RObject::~RObject()'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text+0x389): undefined reference to
`Rcpp::RObject::~RObject()'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text+0x420): undefined reference to
`forward_exception_to_r(std::exception const&)'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text$_ZN4Rcpp6VectorILi14EED1Ev[Rcpp::Vector<14>::~Vector()]+0x13):
undefined reference to `Rcpp::RObject::~RObject()'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text$_ZN4Rcpp6VectorILi14EE6updateEv[Rcpp::Vector<14>::update()]+0xd):
undefined reference to `double* Rcpp::internal::r_vector_start<14,
double>(SEXPREC*)'
file10bc7da0783e.o:file10bc7da0783e.cpp:(.text$_ZN4Rcpp6VectorILi14EED0Ev[Rcpp::Vector<14>::~Vector()]+0x13):
undefined reference to `Rcpp::RObject::~RObject()'
collect2: ld returned 1 exit status
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 file10bc7da0783e( SEXP x) ;
24: }
25:
26: // definition
27:
28: SEXP file10bc7da0783e( SEXP x ){
29: BEGIN_RCPP
30:
31: NumericVector xx(x);
32: return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));
33: END_RCPP
34: }
35:
36:
sessionInfo() provides the following data:
> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RcppExamples_0.1.3 RcppClassic_0.9.1 inline_0.3.8 Rcpp_0.9.10
loaded via a namespace (and not attached):
[1] tools_2.15.0
Thanks in advance
--
Owe Jessen
http://privat.owejessen.de
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel