3

I am trying to install Rstan. I have no problem installing the package and running it. However, when I try running a program that uses the library I get the following error:

    Error in compileCode(f, code, language = language, verbose = verbose) : 
sh: line 1: K:/Software/rtools40/ucrt64/mingw_64/bin/g++: 
No such file or directorymake: *** [K:/Software/R-41~1.2/etc/x64/Makeconf:245: file9706b781d3e.o] Error 127
Error in sink(type = "output") : invalid connection

I have spent some time trying to trouble shoot it but I simply cannot solve it. I have checked that rtools is in the path using:

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

When I went directly into the directorymake referenced by the error [K:/Software/R-41~1.2/etc/x64/Makeconf:245: file9706b781d3e.o] it is there! But the K:/Software/rtools40/ucrt64/mingw_64/bin/g++ is not. Specifically the ~/mingw_64/bin/g++.
Does anyone has had this issue?
How can I point rstan to a different directory or restore the default one? (Note: I have uninstall it and install it using the headers and without headers and updated rtools and R

Phil
  • 7,287
  • 3
  • 36
  • 66
EduardoRod
  • 105
  • 1
  • 8

1 Answers1

3

Answer: Needed to configure the C++ Tool Chain as per this guide: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows . I had issues with this as well but everything got resolved when I deleted the .Rprofile file int he documents folder.

After configuring the C++ tool I put Rtools in the path again and it worked seamlessly!

EduardoRod
  • 105
  • 1
  • 8