Error in compileCode(f, code, language = language, verbose = verbose) :

Hi! I am a new Rstan user. The whole install process was sucessful in Windows 10. WhenI try a simple rstan example shown in youtube (Getting started with Stan in R - YouTube), there comes the error shown below.

Error in compileCode(f, code, language = language, verbose = verbose) :
from C:/Users/Lenovo/Documents/R/win-library/3.6/StanHeaders/include/src/stan/model/model_header.hpp:4, from file5f484d2de.cpp:14:C:/Users/Lenovo/Documents/R/win-library/3.6/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:14:13: warning: ‘void stan::math::set_zero_all_adjoints()’ defined but not used [-Wunused-function] static void set_zero_all_adjoints() { ^make: *** [C:/PROGRA~1/R/R-36~1.3/etc/x64/Makeconf:215: file5f484d2de.o] Error 1
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/RBUILD~1/3.5/mingw_/bin/g++’ not found
Error in sink(type = “output”) : invalid connection

It seems to be the error related to Stanheaders? I am not sure. I also read some related topics, but it still cannot work. Any advise would be most appreciated. Thank you for your help and valuable time.

My rstan version is 2.21.2, R version is 3.6.3

Hey there!

This is absolutely not in my comfort zone, but I’ll give it a try, haha.

It says ‘C:/RBUILD~1/3.5/mingw_/bin/g++’ not found, so presumably when you open a console (Windows key, then type cmd and hit enter) and write g++ --version is not showing you info like:
screen
If you don’t see this, then pehaps you just need to add it to your PATH.

Cheers,
Max