-1

I have an issue compiling the RInside examples on Windows.

In Rstudio, running

sourceCpp("C:/Users/Admin/Documents/R/win-library/3.5/RInside/examples/standard/rinside_sample0.cpp")

gives

fatal error: RInside.h: No such file or directory

From the command promt, running

cd C:\Users\Admin\Documents\R\win-library\3.5\RInside\examples\standard
make -f Makefile.win rinside_sample0

gives

Error in loadNamespace(name) : aucun package nommé 'Rcpp' n'est trouvé
Error in loadNamespace(name) : aucun package nommé 'RInside' n'est trouvé

Apparently these packages are not found, so I tried the following:

  1. Ran this from the command line set R_HOME=C:\Program Files\R\R-3.5.2
  2. Checked that Rtools and R dirs are present in the path
  3. Modified the Makefile.win like so:

R_LIBS_USER := "C:/Users/Admin/Documents/R/win-library/3.5"

R_ARCH := --arch x64

But still getting the same errors. Any help? Thanks


EDIT: this answer might provide a solution by including this line of code somewhere

export R_LIBS_SITE=c:/R/site-library

However I don't know where to include it.


EDIT2 I have tried to reinstall Rcpp and RInside in both library locations (by running RStudio as admin)

remove.packages("Rcpp", lib = .libPaths())
remove.packages("RInside", lib = .libPaths())
install.packages("RInside", lib = .libPaths())
install.packages("Rcpp", lib = .libPaths())
library("RInside")
library("Rcpp")

In RStudio I still have the same error using sourceCpp, however, using the comand prompt and make approach I do get a different error:

make -f Makefile.win rinside_sample0 
g++.exe: error: Files/R/R-3.5.2/library/RInside/include: No such file or directory

I suppose the space in the path is the problem " Files..." will try to reinstall R in a non-spaced path

gaut
  • 5,771
  • 1
  • 14
  • 45
  • 2
    See https://stackoverflow.com/questions/36034628/c-r-rinside-in-windows-7-machine/ and number of other duplicates. In a nutshell, you're doing it wrong. – Dirk Eddelbuettel Feb 17 '19 at 21:23
  • Hi Dirk, I followed exactly the steps you described in this answer you just provided. What did I do wrong? – gaut Feb 17 '19 at 21:29
  • 2
    You and your R installation are fighting. It tells you it has no Rcpp or RInside. Which makes compiling RInside examples a little difficult. – Dirk Eddelbuettel Feb 17 '19 at 21:39

1 Answers1

0

Reinstalling R in a path without spaces, installing the latest packages, and setting R_HOME environment variable to the new installation folder C:\R\R-3.5.2 solved the problem.

remove.packages("Rcpp", lib = .libPaths())
remove.packages("RInside", lib = .libPaths())
install.packages("RInside", lib = .libPaths())
install.packages("Rcpp", lib = .libPaths())
library("RInside")
library("Rcpp")
gaut
  • 5,771
  • 1
  • 14
  • 45