Skip to content
Prev 3831 / 10988 Next

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

On 22 May 2012 at 01:04, Michael Hannon wrote:
| Darren Cook <darren at dcook.org> wrote:
| 
| >> 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.

Correct -- the RInside package comes with four example directories.

And each of these four directories has a Makefile.  The easiest to start with is

   examples/standard/Makefile

as you can simply drop in a new file 'myhelloworld.cpp' (or any other name
you choose) into this directory and say 'make myhelloworld' --- and the
binary 'myhelloworld' will be created for you.

It does this by querying R via Rscript to learn about 

   headers and libraries for R

   headers and libraries for Rcpp

   headers and libraries for RInside

and all six components are needed for compiling and linking.  

Dirk