[Rcpp-devel] Problem with RInside "hello world" example

Darren Cook darren at dcook.org
Tue May 22 09:40:13 CEST 2012

> I've run into a problem with the RInside "hello world" example.  I can not
> get it to compile on my system.  The first of the many error messages is:
>     undefined reference to `RInside::RInside(int, char const* const*, bool)

You are not telling g++ where to find the R libraries that you need to
link with.

I've a similar basic RInside example and I've got a comment in the
header that says compile it with this:

g++ -I/usr/local/lib/R/site-library/Rcpp/include
-I/usr/local/lib/R/site-library/RInside/include -I/usr/share/R/include
-L/usr/lib64/R/lib -lR -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp
-L/usr/local/lib/R/site-library/RInside/lib -lRInside
-Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -lRInside
-Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib main.cpp

You may have to adjust the paths (I'm on ubuntu 10.04, and I think
default locations for all R packages), but it gives you an idea of what
you're missing.


P.S. In that same directory I've also a rather long Makefile that
describes itself as a "simple Makefile". It doesn't look like I wrote
it; I guess it is from the RInside examples or vignette.

Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)

More information about the Rcpp-devel mailing list