c++rrcpprcpp11

Compiling under Rcpp11 fails, cannot find 'future'


I'm attempting to compile an R package using the Rcpp11 bindings to use a C++11 binary under the hood. I have successfully compiled and used this package on my Mac (OSX 10.9.5, the compiler is clang++):

Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix

However, an attempt to compile under 64-bit Red Hat Linux with the g++ compiler version 4.4.7-4 fails because the header or library or namespace called future cannot be found:

In file included from RcppExports.cpp:4: /path/to/R-libs/3.1/Rcpp11/include/Rcpp.h:50:18: error: future: No such file or directory

As far as I know, future is part of the C++11 specification. I find it odd that several other namespaces are successfully loaded (we successfully make it to the 50th line of Rcpp.h), but future doesn't. Is this due to using an outdated compiler? For reference, I'll attach the actual call to the g++ compiler that fails:

g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/path/to/R-libs/3.1/Rcpp11/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o


Solution

  • When Rcpp11 does not compile, it usually means that the compiler is not a C++11 compiler. Previous versions of Rcpp11 used some compromise on what C++11 means, but the next versions won't compromise. C++11 = C++11, not unfinished C++0x.

    What makes C++11 and forward great is how all these pieces fit together.

    Having a C++11 compiler is the price to pay to use Rcpp11. I see this as a feature.