<div dir="ltr">Hey,<div><br></div><div>you might consider using RStudio which makes this work pretty much out of the box: </div><div><a href="https://support.rstudio.com/hc/en-us/articles/200486088-Using-Rcpp-with-RStudio">https://support.rstudio.com/hc/en-us/articles/200486088-Using-Rcpp-with-RStudio</a>  <br></div><div><br></div><div>Best, Peter</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Di., 28. Jan. 2020 um 10:27 Uhr schrieb Serguei Sokol <<a href="mailto:serguei.sokol@gmail.com">serguei.sokol@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Le 28/01/2020 à 10:04, Gerhard Boenisch a écrit :<br>
> Hi<br>
> <br>
> I am new to rcpp and am unable to compile code I know works. I must be <br>
> doing something stupid.<br>
> <br>
> I am using Windows (10).<br>
> <br>
> I have received the cpp source files for the BHPMF package. We want to <br>
> make the package work on the latest version of R.<br>
> <br>
> I am currently using R 3.4.4 (the last version BHPMF works).<br>
> <br>
> I have installed rcpp (install.packages("Rcpp")).<br>
> <br>
> I have installed RTools.<br>
> <br>
> The source files are in J:\TempWork\BHPMF_CRAN_Archive\src<br>
> <br>
> I am using the RTools C++ compiler in C:\Progs\Rtools\mingw_64\bin\c++.exe<br>
> <br>
> When I try to compile, the compiler cannot find file R.h and ends with <br>
> error message:<br>
> <br>
> J:\TempWork\BHPMF_CRAN_Archive\src>C:\Progs\Rtools\mingw_64\bin\c++.exe <br>
> HPMF_main.cpp<br>
> <br>
> HPMF_main.cpp:11:35: fatal error: R.h: No such file or directory<br>
> <br>
> #include <R.h>      // R functions<br>
> <br>
>                                     ^<br>
> <br>
> compilation terminated.<br>
> <br>
> Can someone please tell me how I can tell the compiler to find R.h and <br>
> the other files from the rcpp package?<br>
> <br>
> I  compile from the command prompt. Is this the right way or must I do <br>
> this in R?<br>
> <br>
> Have I missed installing something? Have I installed staff in the wrong <br>
> order?<br>
I see two options for compiling your packages.<br>
1. You do<br>
<br>
  R CMD build J:\TempWork\BHPMF_CRAN_Archive\<br>
<br>
which should produce something like BHPMF_1.0.tar.gz (1.0 being an<br>
example of package version). Then<br>
  R CMD check J:\TempWork\BHPMF_1.0.tar.gz (put the true name of the <br>
produced tarball here). After that you can see all used flags and <br>
options in J:\TempWork\BHPMF.Rcheck\00install.out file.<br>
<br>
2. In R session having J:\TempWork\BHPMF_CRAN_Archive\ as working dir you do<br>
<br>
  devtools::load_all()<br>
<br>
The first option is better suited for final stages of your dev work <br>
while the second one is more appropriate for your iterative dev cycles.<br>
<br>
Best,<br>
Serguei.<br>
<br>
> <br>
> Thanks in advance.<br>
> <br>
> Best wishes<br>
> <br>
> <a href="mailto:Gerhard_________________________boenisch@bgc-jena.mpg.de" target="_blank">Gerhard_________________________boenisch@bgc-jena.mpg.de</a> <br>
> <mailto:<a href="mailto:Gerhard_________________________boenisch@bgc-jena.mpg.de" target="_blank">Gerhard_________________________boenisch@bgc-jena.mpg.de</a>><br>
> <br>
> Scientific Data Manager<br>
> <br>
> Dr. Gerhard Boenisch                     Phone: +49 3641 576277<br>
> <br>
> MPI für Biogeochemie                   Fax:        +49 3641 577200<br>
> <br>
> Hans-Knoell Str. 10,                         07745 Jena,        Germany<br>
> <br>
> <a href="http://www.bgc-jena.mpg.de/~boenisch" rel="noreferrer" target="_blank">http://www.bgc-jena.mpg.de/~boenisch</a><br>
> <br>
> <br>
> _______________________________________________<br>
> Rcpp-devel mailing list<br>
> <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
> <br>
<br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a></blockquote></div>