How to use rstan 2.17.4

The short version is “don’t”, i.e. do not update your rstan or StanHeaders installation. If you already have or just installed rstan for the first time, then you are going to need to call

Sys.setenv(USE_CXX14 = 1)

once per session before trying to compile a Stan program.

Also, you need to define CXX14 and CXX14FLAGS in your ~/.R/Makevars file. This should be automatic on a Mac if you use the installer. It probably has to be done manually on WIndows, in which case ~/.R/Makevars should read as

CXX14 = g++ -std=c++1y
CXX14FLAGS = -O3 -Wno-unused-variable -Wno-unused-function

On Linux, CXX14 may or may not be defined and you may or may not need to specify it as something like g++ or clang++ depending on what compilers may or may not be installed which may or may not have version numbers postfixed to the executable command.

2 Likes