[Rcpp-devel] Compile RcppEigen code using SHLIB

Søren Højsgaard sorenh at math.aau.dk
Thu Jun 28 00:08:47 CEST 2012


I would like to compile .cpp code based on RcppEigen using R CMD SHLIB. 

To test this I have created a "sample" package using: RcppEigen.package.skeleton( "foobar" )

In the src directory of foobar there is a sample .cpp file which I try to compile with (I am on Windows 7)

C:\Documents\stat\Rdevel\gRbaseDEVEL\foobar\src>R CMD SHLIB rcppeigen_hello_world.cpp
g++ -m64 -I"C:/programs/R/current/include" -DNDEBUG     -I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O2 -Wall
 -mtune=core2 -c rcppeigen_hello_world.cpp -o rcppeigen_hello_world.o
In file included from rcppeigen_hello_world.cpp:1:0:
rcppeigen_hello_world.h:4:23: fatal error: RcppEigen.h: No such file or directory
compilation terminated.
make: *** [rcppeigen_hello_world.o] Error 1

The automatically created Makevars.win file contains the line:
PKG_LIBS = $(shell $(R_HOME)/bin/Rscript.exe -e "Rcpp:::LdFlags()")
- and this does not seem to catch RcppEigen.h which is in /library/RcppEigen. 

Question: Can anyone tell what should be written in the Makevars to be able to compile using R CMD SHLIB ??
Thanks in advance.

Best regards
Søren



More information about the Rcpp-devel mailing list