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