Re: [Rd] RInside, rcpp compilation problem

From: Dirk Eddelbuettel <>
Date: Tue, 04 Dec 2012 22:41:56 -0600

On 4 December 2012 at 22:47, Simon Urbanek wrote:
| On Dec 4, 2012, at 10:00 PM, Jeff Goode wrote:
| > I have spent some hours browsing the RInside and rcpp documentation, lots of it; but ... as a programmer of C++ since 1990, on both Windows and Unix ... ( Solaris and Ubuntu, and Mandrake/Mandrivo Linux); I see a minor problem ...... Where is the rcpp.h header file??
| In the Rcpp package which RInside links to.

Correct. And Depends: upon.

| Please use rcpp-devel mailing list for such questions (as per request of the authors).

Mostly as a courtesy to readers of r-devel. And several different folks may respond via rcpp-devel, not all of whom read here as well.

So redirecting via CC:, please feel free to keep follow-up there (but you need to be subscribed to post).

| > The below code fails to compile as the RInside.h header file references the rcpp.h header file, which is not included with RInclude download. This is the sample code provided in one of the RInside manuals:
| > #include <iostream>
| >
| > #include <RInside.h> // for the embedded R via RInside
| > rcpp::NumericMatrix createMatrix(const int n) {
| > Rcpp::NumericMatrix M(n,n);
| > for (int i=0; i<n; i++) {
| > for (int j=0; j<n; j++) {
| > M(i,j) = i*10 + j;
| > }
| > }
| > return(M);
| > }

You appear to have clipped this from examples/standard/rinside_sample1.cpp

That very directory examples/standard, and its neighbouring directories, each have

    i) a Makefile for Linux, OS X, ... and

    ii) a for Win*, and

    iii) contributed cmake/ files

all of which do the build. RInside needs itself, Rcpp and R so a few -I and -L switches need to set --- which those three alternatives do for you.

So if you, say, do 'cp rinside_sample1.cpp jeff1.cpp' you can just say 'make jeff1' and the executable will be built. That is a feature. The Makefile should work for your projects, and the other makefiles in the neighbouring directories show how to do this with MPI, Qt, Wt, and (in SVN) Boost.


Dirk Eddelbuettel | |

______________________________________________ mailing list
Received on Wed 05 Dec 2012 - 04:46:23 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Dec 2012 - 11:32:45 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive