-1

I just used Rcpp

Rcpp::sourceCpp('D:\\6_R_tool\\04_track_cluster\\line_cluster_c.cpp')

and error occcurs: It works Ok some days ago, but failed today suddenly.

My R version is 4.0.2.

C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding commands for target `.m.o'
C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old commands for target `.m.o'
"C:/rtools40/mingw64/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG   -I"C:/Users/justin/Documents/R/win-library/4.0/Rcpp/include" -I"D:/6_R_tool/04_track_cluster"        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c line_cluster_c.cpp -o line_cluster_c.o
process_begin: CreateProcess(NULL, basename sourceCpp_2.dll .dll, ...) failed.
process_begin: CreateProcess(NULL, basename sourceCpp_2.dll .dll, ...) failed.
process_begin: CreateProcess(NULL, basename sourceCpp_2.dll .dll, ...) failed.
"zline_cluster_c.o" was unexpected at this time.
make: *** [sourceCpp_2.dll] Error 255
Error in Rcpp::sourceCpp("D:\\6_R_tool\\04_track_cluster\\line_cluster_c.cpp") : 
  Error 1 occurred building shared library.

WARNING: The tools required to build C++ code for R were not found.

Please download and install the appropriate version of Rtools:

http://cran.r-project.org/bin/windows/Rtools/

What can be the problem and what should I do?

Justin
  • 327
  • 3
  • 13

2 Answers2

0

It is resolved by typing the command in RGui.

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

And I noted that the path has been reset. See it by Sys.which("make") .

The new path is "C:\\rtools40\\usr\\bin\\make.exe", whose value is definitely different before I fixed the problem.

But who can I tell me why? Thank you.

Justin
  • 327
  • 3
  • 13
0

Watch this video https://www.youtube.com/watch?v=hBTObNFFkhs and ensure that you get a result. If there is a warning, something is not correct.

Also, in my case, using Rtools42. Here is my new path:

PATH="C:\rtools42\usr\bin;${PATH};C:\Program Files\R\R-4.2.2\library\stats\libs\x64"

Here is my command running on the R STUDIO console

writeLines('PATH="C:\rtools42\usr\bin;${PATH};C:\Program Files\R\R-4.2.2\library\stats\libs\x64"', con = "~/.Renviron")

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 07 '23 at 21:27