[Rcpp-devel] Problem with compiling a code for RcppArmadillo

Romain Francois romain.francois at dbmail.com
Wed May 19 16:26:55 CEST 2010

Please follow the documentation. See ?RcppArmadillo

See also the announcement on my blog:

Le 19/05/10 16:18, Abhisek a écrit :
> Hi,
> I am trying to use the following lines to compile a cpp code
> export PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"`
> export PKG_CXXFLAGS=`Rscript -e "Rcpp:::CxxFlags()"`
> R CMD SHLIB gamwibTrial.cpp

That is not enough. You need also the include path of RcppArmadillo in 

system.file( "include", package = "RcppArmadillo" )

and you need additional libraries in your PKG_LIBS:


All of this is written in clear text in both sources of documentation.

> I get the following error
> g++ -I/usr/share/R/include
> -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/include -fpic  -g
> -O2 -c gamwibTrial.cpp -o gamwibTrial.o
> In file included from gamwibTrial.cpp:2:
> /usr/local/include/RcppArmadillo.h:25:34: error: RcppArmadilloForward.h:
> No such file or directory
> i did a search for RcppArmadilloForward.h but did not find it.  I have
> updated to the latest versions of Rcpp and RcppArmadillo today.

how did you search ? from the installed RcppArmadillo, I can do :

$ find . -name "RcppArmadilloForward.h"

> i realize that i should be using RcppArmadillo in a package setting but
> im still trawling through that documentation.  In the meantime I am just
> trying to see if the code will compile.

Just run RcppArmadillo.package.skeleton and use a package, you'll do 
yourself a favor.

> Many thanks for your help!
> Abhisek

Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
|- http://bit.ly/bklUXt : RcppArmadillo 0.2.1
|- http://bit.ly/936ck2 : Rcpp 0.8.0
`- http://bit.ly/9aKDM9 : embed images in Rd documents

More information about the Rcpp-devel mailing list