Carl
Carl

Reputation: 5779

Warning whenever I run sourceCpp

I am having trouble running Rcpp on my PC in RStudio. Whenever I sourceCpp() a cpp file, even the Hello World file that comes with Rcpp::Rcpp.package.skeleton(), I get the warning

In normalizePath(path.expand(path), winslash, mustWork) :
  path[1]=".../anRpackage/src/../inst/include": The system cannot find the path specified 

I searched Stackoverflow and it looks like some people get this warning if they don't have Depends: Rcpp in the DESCRIPTION of their package, but I am just running sourceCpp() so the DESCRIPTION file shouldn't matter (I also changed my DESCRIPTION file). It is just a warning so the class and functions I wrote do appear in R, but RStudio frequently crashes after I use the functions in R a few times, which may or may not be related.

My session info:

R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Rcpp_0.12.1         RevoUtilsMath_7.4.1 RevoUtils_7.4.1     RevoMods_7.4.1      RevoScaleR_7.4.1    lattice_0.20-30     rpart_4.1-9        

loaded via a namespace (and not attached):
[1] codetools_0.2-10 foreach_1.4.2    grid_3.1.3       iterators_1.0.7  tools_3.1.3  

I suppose it is possible that Revolution R is the culprit here, but I have no way of knowing. I would appreciate help, because I don't want to ignore this warning, and it's obviously not ideal for RStudio to crash repeatedly.

Kind Regards

Upvotes: 5

Views: 1140

Answers (1)

Mossa
Mossa

Reputation: 1709

This is still relevant today, so here's my discoveries.

Rcpp can generate interfaces to and from C++ and R. These are generated with the help of attributes specified in source-files.

From these attributes, the call to Rcpp::compileAttributes() produces the headers. Whilst at it, this also create the folder <package directory>/inst/include. If you have specified no attributes, anywhere, then compileAttributes() does not create these directories.

In order to get rid of this warning, create the <package directory>/inst/include.

For more on attributes, see Rcpp attributes vignette.

Upvotes: 8

Related Questions