error installing packages that require compilation

Hi all - was hoping someone could help. I'm trying to install a few different packages and get the same errors - I'm not sure how to fix - any help would be greatly appreciated.

Installing package into ‘C:/Users/psonk/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)

There is a binary version available but the source version is later:
binary source needs_compilation
ranger 0.14.1 0.15.1 TRUE

installing the source package ‘ranger’

trying URL ''
Content type 'application/x-gzip' length 162164 bytes (158 KB)
downloaded 158 KB

  • installing source package 'ranger' ...
    ** package 'ranger' successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-42~1.3/include" -DNDEBUG -DR_BUILD -DWIN_R_BUILD -I'C:/Users/psonk/AppData/Local/R/win-library/4.2/Rcpp/include' -I'C:/Users/psonk/AppData/Local/R/win-library/4.2/RcppEigen/include' -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c AAA_check_cpp11.cpp -o AAA_check_cpp11.o
    sh: g++: command not found
    make: *** [C:/PROGRA~1/R/R-42~1.3/etc/x64/Makeconf:260: AAA_check_cpp11.o] Error 127
    ERROR: compilation failed for package 'ranger'
  • removing 'C:/Users/psonk/AppData/Local/R/win-library/4.2/ranger'
  • restoring previous 'C:/Users/psonk/AppData/Local/R/win-library/4.2/ranger'
    Warning in install.packages :
    installation of package ‘ranger’ had non-zero exit status

Did you install Rtools?

Thanks for the response. Yes I installed r tools.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

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