[R] Rinternals.h and iostream don't play nice together'

Paul Roebuck roebuck at odin.mdacc.tmc.edu
Mon Jan 31 00:24:32 CET 2005


On Sun, 30 Jan 2005, Faheem Mitha wrote:

> Consider the following file.
>
> *******************************
> foo.cc
> *******************************
> #include <R.h>

and if you use the following instead of "Rinternals.h"?
extern "C" {
#include <Rdefines.h>
}

> #include <Rinternals.h>
> #include <iostream>
> *******************************
>
> R CMD SHLIB foo.cc
>
> gives scads of errors. I've use C++ extensively with R before (using C
> linkage) but not with Rinternals.h. I'm puzzled. The errors make no sense
> to me. Am I doing something wrong? Is it impossible to use iostream here
> for some reason?
> [SNIP lots of error messages]

'Course I'm assuming you read that part in the 'R-exts.pdf'
about using C++ iostreams with R being best avoided? If you
really need to do so anyway, I'll give you a link to my iostream
manipulator source that interfaces with the R console. It handles
the scenario described in section 4.6 of above document but
requires the GNU C++ compiler (g++) in order to work though.

----------------------------------------------------------
SIGSIG -- signature too long (core dumped)




More information about the R-help mailing list