[Rcpp-devel] Rcpp C++11 on Windows

Peter Meissner retep.meissner at gmail.com
Wed Jan 27 11:35:25 CET 2016

Hey Listeners,

I am quite solid in R but a complete noob to C++ and Rcpp so please excuse  
if do not get it right ...

My problem is that I would like to have a package using Rcpp AND using  
C++11 features AND working on both Linux (Debian derivates) and Windows.  
For Linux I seem to be on the right track and features like 'auto' and  
'iterators' do work. On Windows however it will not compile.

As far as I understand it, the main problem is that Rtools comes with a  
compiler that simply does not support those features (g++ version 4.6.3).  
Furthermore, I found that C++11 features are not CRAN compatible - right?

Do I get it right so far? Can you give guidance on how best to proceed?  
Should I get a newer g++/or-other compiler and make it the system default?  
What are best or good working practices? Windows/Linux is a must and  
system tweaks for other Windows users installing/building the package  
should be minimal, though CRAN compliance would be only a minor extra.

I hope I did not miss some obvious documentation or already existing  

Best, Peter

Compilation error:

   * installing to library 'C:/Users/Admin/Documents/R/win-library/3.2'
   * installing *source* package 'spanmatcher' ...
   g++ -m64 -std=c++0x -I"C:/PROGRA~1/R/R-32~1.3/include" -DNDEBUG     
-I"d:/RCompile/r-compiling/local/local323/include"     -O2 -Wall   
-mtune=core2 -c span_matcher_worker.cpp -o span_matcher_worker.o
   ** libs
   g++ -m64 -shared -s -static-libgcc -o spanmatcher.dll tmp.def  
RcppExports.o span_matcher_worker.o  
-LC:/PROGRA~1/R/R-32~1.3/bin/x64 -lR
   collect2: ld returned 148 exit status
   no DLL was created
   ERROR: compilation failed for package 'spanmatcher'

My system:

   R version 3.2.3 (2015-12-10)
   Platform: x86_64-w64-mingw32/x64 (64-bit)
   Running under: Windows >= 8 x64 (build 9200)

   [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
   [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
   [5] LC_TIME=German_Germany.1252

   attached base packages:
   [1] stats     graphics  grDevices utils     datasets  methods   base

   other attached packages:
   [1] devtools_1.9.1 Rcpp_0.12.2

   loaded via a namespace (and not attached):
   [1] tools_3.2.3

Erstellt mit Operas E-Mail-Modul: http://www.opera.com/mail/

More information about the Rcpp-devel mailing list