Skip to content

[Rcpp-devel] Windows set C++11 flag for new compiler

8 messages · Dirk Eddelbuettel, Charles Determan, Martyn Plummer

#
I have installed a more recent compiler and would like to use the
-std=c++11 flag instead of the -std=c++0x.

system('g++ --version')
truncated... 5.2.0

I have a Makevars.win file where I initially set the CXX_STD=CXX11 however
this uses the default C++11 flag returned from R CMD config CXX1XSTD (i.e.
c++0x).  This is insufficient as I am using template aliases (not supported
in c++0x).

I also tried putting the -std=c++11 directly in the PKG_CXXFLAGS but I get
an error stating:

cc1plus.exe: error: unrecognized command line option '-std=c++11'

I can use the C++11 flag if I set PKG_CXXFLAGS manually and run sourceCpp
on a single file but I want to apply it over an entire package.

Thanks,
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20151110/87289348/attachment.html>
#
On 10 November 2015 at 10:00, Charles Determan wrote:
| I have installed a more recent compiler and would like to use the -std=c++11
| flag instead of the -std=c++0x.
| 
| system('g++ --version')
| truncated... 5.2.0
| 
| I have a Makevars.win file where I initially set the CXX_STD=CXX11 however this
| uses the default C++11 flag returned from R CMD config CXX1XSTD (i.e. c++0x).?
| This is insufficient as I am using template aliases (not supported in c++0x).
| 
| I also tried putting the -std=c++11 directly in the PKG_CXXFLAGS but I get an
| error stating:
| 
| cc1plus.exe: error: unrecognized command line option '-std=c++11'

That would suggest that g++-4.6.2.exe is still running.

Dirk
 
| I can use the C++11 flag if I set PKG_CXXFLAGS manually and run sourceCpp on a
| single file but I want to apply it over an entire package.
| 
| Thanks,
| Charles
| 
| 
| 
| _______________________________________________
| 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
#
Okay, is there a way for me to use the newer compiler for building the
package on Windows?  I've tried everything I can think of and fail to get
the new one to register when building a package.

Charles
On Tue, Nov 10, 2015 at 10:16 AM, Dirk Eddelbuettel <edd at debian.org> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20151110/8d662e56/attachment.html>
#
On 10 November 2015 at 10:18, Charles Determan wrote:
| Okay, is there a way for me to use the newer compiler for building the package
| on Windows?? I've tried everything I can think of and fail to get the new one
| to register when building a package.

Set CXX1X in Makevars or in R's $RHOME/etc/Makeconf

Dirk
#
On Tue, 2015-11-10 at 10:30 -0600, Dirk Eddelbuettel wrote:
It is the flag CXX1XSTD that should be overridden. With the Windows CRAN
binary it is set to:

CXX1XSTD = -std=c++0x

For more details on custom compilation see section 6.3.3 of the R
Installation and Administration manual (a.k.a R-admin)

Martyn
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------
#
The std=c++0x is not sufficient for my purposes as it doesn't support
template aliases.  I have tried to set CXX1XSTD=-std=c++11 in the
Makevars.win but it doesn't appear to register.  The build proceeds as if I
never set the variable.  Are the any packages that accomplish this?

Charles
On Tue, Nov 10, 2015 at 10:42 AM, Martyn Plummer <plummerm at iarc.fr> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20151110/d3f8d039/attachment.html>
#
If you try setting this flag in the Makevars.win file of your package
then it will be overridden by the site-wide Makeconf which is included
after your package-specific Makevars.win (See section 1.2.1 of R-exts)

What you need to do is set it in a personal file HOME/.R/Makevars.win
(See R-admin 6.3.3). On Windows, "HOME" is usually your Documents
folder.

Martyn
On Tue, 2015-11-10 at 10:45 -0600, Charles Determan wrote:
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------
#
Martyn,

This ultimately solved my problem.  However, I also needed to set CXX1X as
R continued to try and use the 4.6.3 version.  Once both CXX1X and CXX1XSTD
were set in the HOME/.R/Makevars.win file, the compilation ran successfully.

Thanks,
Charles
On Tue, Nov 10, 2015 at 10:57 AM, Martyn Plummer <plummerm at iarc.fr> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20151110/19a526e3/attachment.html>