Error in .shlib_internal(args) : C++14 standard requested but CXX14 is not defined


On several occasions when I have tried to update a package requiring compilation on my Windows 10 machine (most recently trying to update rstanarm) the installation has failed with the error message:

Error in .shlib_internal(args) :
C++14 standard requested but CXX14 is not defined

I have no problem updating these packages on my Ubuntu machine. Ultimately I am able to update these packages if/when a compiled version appears on CRAN.
But I'd like to fix the problem. I suspect some glitch on the compile system on my Windows machine, but I have no idea how to fix this problem.

For what it's worth, RTools 3.5 is installed, devtools 2.0.0 is installed, and pkgbuild::chk_rtools() returns TRUE. As has been true for some time now, there appears to be no Rtools package available for R 3.5.1.

Thanks in advance for any suggestions how to fix this.
Larry Hunsicker



The instructions for configuring a Windows machine to install rstan seems to have helped some other people getting the same/similar error messages:


The instructions (which you should definitely look at directly— I don't have a Windows machine, so I haven't tested it) include code to make or edit a Makevars file, which explicitly sets CXX14:

dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) 
M <- file.path(dotR, "")
if (!file.exists(M)) 
cat("\nCXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function",
    "CXX14 = $(BINPREF)g++ -m$(WIN) -std=c++1y",
    "CXX11FLAGS=-O3 -Wno-unused-variable -Wno-unused-function",
    file = M, sep = "\n", append = TRUE)


That worked both for rstan and rstanarm. Thanks a millon!
Larry Hunsicker

1 Like

split this topic #4

A post was split to a new topic: Installing ‘rstan' on CentOS7? the version of gcc is 4.8.5 does not seem to support CXX14



+1 for easy copy/paste solution!



This topic has been closed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.