Dirk Eddelbuettel <e...@debian.org> wrote: > On 22 May 2012 at 01:04, Michael Hannon wrote: >| Darren Cook <dar...@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. Hmm. Thanks, Dirk. That Makefile is downright spooky smart (and worth a study in its own right). I was unaware of the "RHOME" option for R and the "shell" function in GNU make. Given that I had only one *.cpp file in the directory, I got the binary to build simply by typing "make", but I did check that "make <filename>" also appears to work.
-- Mike _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel