[Rcpp-devel] C++11 in Windows R package

John Buonagurio jbuonagurio at exponent.com
Thu May 29 17:45:55 CEST 2014


Dirk and Matteo,

This is a MinGW issue, which as far as I can tell is undocumented.

When CXX_STD=CXX11 is added to Makevars.win, R ultimately translates this to "-std=c++0x" in the g++ command (via CXX1XSTD in Makeconf). For some reason, MinGW then #undefs WIN32. This doesn't happen using use "-std=gnu++0x"

You can work around this by checking for _WIN32 instead of WIN32, or just add another define:

#ifdef _WIN32
#define WIN32
#endif

But, as you saw even with this fixed, Armadillo still has issues with the Rtools GCC...

Best,
John

| -----Original Message-----
| From: rcpp-devel-bounces at lists.r-forge.r-project.org [mailto:rcpp-devel-
| bounces at lists.r-forge.r-project.org] On Behalf Of Dirk Eddelbuettel
| Sent: Thursday, May 29, 2014 9:32 AM
| To: Matteo Fasiolo
| Cc: rcpp-devel at lists.r-forge.r-project.org
| Subject: Re: [Rcpp-devel] C++11 in Windows R package
| 
| 
| On 29 May 2014 at 14:27, Matteo Fasiolo wrote:
| |  hopefully this is what you meant: I have searched the sources of
| | RcppArmadillo, Rcpp and R-3.1.0 for the string "#undef WIN32", but I
| | didn't find anything.
| |
| | I used for example: grep -rnw 'RcppArmadillo' -e '#undef WIN32'
| 
| I was just on the commuter train, did the same and didn't see it either.
| 
| But here is another idea: add    -DWIN32   in src/Makevars.win.  Maybe that
| definition "survives" and you end up in the right branch.
| 
| Dirk
| 
| --
| Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
| _______________________________________________
| 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


More information about the Rcpp-devel mailing list