[R] How to resolve include Rcpp.h problems?

Romain Francois romain.francois at dbmail.com
Sun Dec 13 19:37:33 CET 2009


Hi,

The file lives in the lib directory of the installed package Rcpp.

Rscript -e "cat(system.file( 'lib', 'Rcpp.h', package = 'Rcpp' ))"

The maintainer of Rcpp (cc'ed, just in case) will tell you more tricks. 
Note that Rcpp has its own mailing list. 
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel 
where questions like this might be more appropriate.

Romain

On 12/13/2009 09:56 AM, Amine Jallouli wrote:
>
> Hi,
> I am Linux Ubuntu 9.04 user. I'm using R-2.6.
>
> Actually, I am developing R package for reading/writing 3D images. I needed
> to use  the R package Rcpp in order to make profit of available C/C++ codes.
> My problem is that my C code is not able to include the Rcpp.h
>
> In fact, when I run this command R CMD build rply, I got the following error
> message in the file /home/amine/R/r-eclipse/rply.Rcheck/00install.out:
> * Installing *source* package 'rply' ...
> ** libs
> gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O2 -c Call_interface.c
> -o Call_interface.o
> gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O2 -c C_interface.c -o
> C_interface.o
> gcc -std=gnu99 -I/usr/share/R/include      -fpic  -g -O2 -c fifrt.c -o
> fifrt.o
> g++ -I/usr/share/R/include      -fpic  -g -O2 -c RCPP_test.cpp -o
> RCPP_test.o
> RCPP_test.cpp:1:18: erreur: Rcpp.h : No such file or directory
> RCPP_test.cpp: In function ‘SEXPREC* readRIntVec(SEXPREC*)’:
> RCPP_test.cpp:14: erreur: ‘RcppVector’ was not declared in this scope
> RCPP_test.cpp:14: erreur: expected primary-expression before ‘int’
> RCPP_test.cpp:14: erreur: expected `;' before ‘int’
> make: *** [RCPP_test.o] Erreur 1
> ERROR: compilation failed for package 'rply'
> ** Removing '/home/amine/R/r-eclipse/rply.Rcheck/rply'
>
> It is evident that I will this error since the file Rcpp.h is not in this
> directory /usr/share/R/include .
>
> I tried to solve this include problem by copying the Rcpp.h to
> /usr/share/R/include. But, it was not successful and I the following error
> message.
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>    Unable to load shared library
> '/home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so':
>    /home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so: undefined symbol:
> _ZN10RcppVectorIiEC1EP7SEXPREC
> Error in library(rply) : .First.lib has failed for 'rply'
> Execution stopped
>
> It looks like this package has a loading problem: see the messages for
> details.
>
>
> Resulting this last error seems to be also logical. In fact, I think the
> file libRcpp.so is need for the compilation of my code.
>
> Please notice that the package Rcpp is installed in the following directory:
> /usr/lib/R/site-library/Rcpp
>
> Thank you for giving an idea for solving this problem.


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/HlX9 : new package : bibtex
|- http://tr.im/Gq7i : ohloh
`- http://tr.im/FtUu : new package : highlight




More information about the R-help mailing list