简体   繁体   中英

Rcpp does not find Rtools

My Problem

I installed Rtools and added the path to my PATH variable:

mPath <- strsplit(Sys.getenv("PATH"), ";")[[1]]
mPath[grep("Rtools", mPath)]
# [1] "C:\\Temp\\Rtools\\bin"              "C:\\Temp\\Rtools\\gcc-4.6.3\\bin"  
# [3] "C:\\Temp\\Rtools\\gcc-4.6.3\\bin32" "C:\\Temp\\Rtools\\mingw_32\\bin"

(So you can see it is not installed directly at c:\\Rtools )

When I try to run a simple Rcpp snippet, I get the following error:

library(Rcpp)
evalCpp("1+1")

[...]

c:/Rtools/mingw_32/bin/g++: not found

So basically Rcpp is looking in C:/Rtools ignoring my PATH variable.

Workaround

If I run

library(installr)
install.Rtools()

Loading required namespace: devtools

No need to install Rtools - You've got the relevant version of Rtools installed

and then run evalRcpp("1+1") again, everything works as expected.

My Question

Why does it not work right away? How do I tell Rcpp to look in the right folder? How does install.Rtools manage to convince Rcpp to look into the right folder? How can I achieve that without the workaround?

Had the same problem. The system is not (yet) compatible with Rtools 3.5. Also, there seems to be an issue that they re-named it to RBuildTools instead of RTools. Install the former version 3.4 on https://cran.r-project.org/bin/windows/Rtools/ . This did the job for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM