[Rcpp-devel] Rcpp C++11 on Windows
edd at debian.org
Wed Jan 27 13:57:30 CET 2016
On 27 January 2016 at 11:13, Martyn Plummer wrote:
| Q1: Does CRAN accept C++11 code?
| A1: Yes but you have to indicate that you are using C++11 rather than C
| ++98, which is still the default standard for CRAN packages. This is
| described in the "Writing R Extensions" manual in section 1.2.4.
Yup. Declaring it is easy. And the consequence _can_ (for now) be that you
may not be able to build on Windows. The g++ 4.6.* compilers supports a
subset of C++11 only.
I declare 'CXX_STD = CXX11' in packages RcppAnnoy, RcppBDT, RcppCCTZ,
RcppCNPy, RcppTOML -- and of these RcppAnnoy, RcppBDT and RcppCNPy *do*
create Windows binaries. Whereas RcppCCTZ and RcppTOML use 'real' C++11 with
features not supported by this old compiler so they exist on Linux and OS X
| Q2: Are C++11 features available on Windows?
| A2: Not yet. Release 4.6.3 includes limited support for C++11 features.
| Again, the "Writing R Extensions" manual will give you more details,
| with a link to a page describing what features are available. There are
| plans to update the toolchain on Windows to 4.9.2. This will improve C
| ++11 support on windows but it will not be complete. The first
| fully-compliant gcc release is 5.1. However, it is not sufficiently
| stable on Windows.
It depends. It is not black/white even if some people insist on portraying it
as such. Many features were added incrementally.
g++-4.6.* has C++0x with some things, g++-4.9 adds quite a lot more and works
for all I do. At work we sometimes rely on C++14 already and use g++-5.2.
So you need to tell us what it is you want to do, or just try it, and the
compiler _currently in use_ may fail. With some luck we may get g++-4.9.* on
Windows with R 3.3.0.
The error you showed from spanmatcher appeared to be a _linker_ error not a
compiler error so something else may be going on there.
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel