[R] interfacing R and c++

Martin Maechler maechler at stat.math.ethz.ch
Wed Jul 3 17:51:42 CEST 2002


>>>>> "NancyW" == Wong, Nancy Diana <nancy_wong at merck.com> writes:

    NancyW> Hi Martin,

    NancyW> Thanks for the quick response.  This is the compile
    NancyW> error I'm getting:

    NancyW> g++ -g -Wall -DDEBUG -I. -I/usr/local/include/vigra
    NancyW> -I/home/reid/install-these/vigra1.1.4/include -I/usr/local/lib/R/include -c
    NancyW> main.c
    NancyW> In file included from /usr/local/lib/R/include/R.h:45,
    NancyW> from main.c:23:
    NancyW> /usr/local/lib/R/include/R_ext/Boolean.h:29: `enum {anonymous} FALSE'
    NancyW> redeclared as different kind of symbol
    NancyW> /usr/lib/qt/include/qglobal.h:381: previous declaration of `const bool
    NancyW> FALSE'
    NancyW> /usr/local/lib/R/include/R_ext/Boolean.h:29: `enum {anonymous} TRUE'
    NancyW> redeclared as different kind of symbol
    NancyW> /usr/lib/qt/include/qglobal.h:382: previous declaration of `const bool TRUE'
    NancyW> In file included from main.c:24:
    NancyW> /usr/local/lib/R/include/Rinternals.h:820: parse error before `1'
    NancyW> make: *** [main.o] Error 1

    NancyW> when I try to include R.h and Rinternals.h

Ok, so we see it's a real conflict with TRUE and FALSE being
defined both 
 in R's   R_ext/Boolean.h  and 
 in qt's  qglobal.h

i.e. both R and qt assume that TRUE/FALSE are not yet defined
and do define them.

For the moment you'll have to fix this up manually, e.g. by
adding an
#ifndef TRUE
....
....
#endif

around the definition in either (or both!) of the two include files.

For R 1.6.0, we should try to prevent this (and the Qt
developers should too ..). 
Proposals welcome.

{and yes, this topic should now move from R-help to R-devel!} 

Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list