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

Martyn Plummer plummerm at iarc.fr
Thu May 29 18:00:12 CEST 2014


Thanks John. I learned something new today. It is probably worth mentioning this in the manual.
Martyn

________________________________________
From: rcpp-devel-bounces at lists.r-forge.r-project.org [rcpp-devel-bounces at lists.r-forge.r-project.org] on behalf of Dirk Eddelbuettel [edd at debian.org]
Sent: 29 May 2014 17:54
To: John Buonagurio
Cc: rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] C++11 in Windows R package

Hi John,

On 29 May 2014 at 15:45, John Buonagurio wrote:
| 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

Nice work. That is very, very good.  I had gone to my default page over at

    http://sourceforge.net/p/predef/wiki/Home/

(which is an excellent resource for these things) and got a reminder that the
"official" one is indeed _WIN32 (with underscore).   However, R internally
uses WIN32 so I picked that too.

Your suggestion will provide a fallback.

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

That's the well-know problem with the toolchain we have imposed on us.  We'll
have to see how we can adjust.   At least it is gcc/g++ 4.6.* and not 4.2.*
as it was on Windows for many years (and still is on older OS X machines).

Dirk

|
| 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

--
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-----------------------------------------------------------------------
This message and its attachments are strictly confidential. If you are
not the intended recipient of this message, please immediately notify 
the sender and delete it. Since its integrity cannot be guaranteed, 
its content cannot involve the sender's responsibility. Any misuse, 
any disclosure or publication of its content, either whole or partial, 
is prohibited, exception made of formally approved use
-----------------------------------------------------------------------


More information about the Rcpp-devel mailing list