0

I want to use Rcpp, but when I use cppFunction (), I get a message to install Rtools as shown below.

I would like to continue installing even if I install it.

I used to have it when I used 3.4.1, but I have a problem, so I erased it and installed version 3.4.2.

enter image description here

Maybe there is a cause, but I do not know how to solve it. I use the following code to delete all packages and re-install Rcpp.

> cppFunction("
+             NumericVector insertsortcpp(NumericVector vector) {
+             int n = vector.size();
+             double tmp;
+             for(int i=1; i<n; i=i+1) {
+             tmp=vector[i];
+             int j=i-1;
+             while(j>=0 && vector[j]>tmp) {
+             vector[j+1]=vector[j];
+             j=j-1;
+             }
+             vector[j+1]=tmp;
+             }
+             return vector;
+             }")
c:/Rtools/mingw_64/bin/g++  -I"C:/R/R-34~1.2/include" -DNDEBUG   -I"C:/Users/ji/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Users/ji/AppData/Local/Temp/RtmpQjHy3A/sourceCpp-x86_64-w64-mingw32-0.12.14"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c file22cc1b9753bc.cpp -o file22cc1b9753bc.o
c:/Rtools/mingw_64/bin/g++: not found
make: *** [file22cc1b9753bc.o] Error 127
Warning message:
running command 'make -f "C:/R/R-34~1.2/etc/x64/Makeconf" -f "C:/R/R-34~1.2/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_4.dll" WIN=64 TCLBIN=64 OBJECTS="file22cc1b9753bc.o"' had status 2 
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir,  : 
  Error 1 occurred building shared library.

My line of code and error statements.

R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Workspace loaded from ~/.RData]

And This is initial screen of R.

I know it's a lot of questions, but I have no place to ask.

I would appreciate your help.

Jiwon Kim
  • 139
  • 3
  • 12
  • Please see the Rcpp FAQ which details that you must install Rtools on Windows. – Dirk Eddelbuettel Nov 29 '17 at 18:38
  • 1
    Read the FAQ and then please follow [these instructions step-by-step](http://thecoatlessprofessor.com/programming/rcpp/install-rtools-for-rcpp/) to properly install Rtools on windows. – coatless Nov 29 '17 at 18:40
  • And then delete this question. – Dirk Eddelbuettel Nov 29 '17 at 18:40
  • i already did that but it does not work. I get an 'Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, : Error 1 occurred building shared library.' error again. – Jiwon Kim Nov 29 '17 at 22:13

0 Answers0