Hi, I'm trying to write a gui program that accesses some R code I've written. The gui is written in c++ and includes qt libraries and vigra libraries (for image manipulation). Unfortunately I've been getting dependencies due to constants getting redefined within the R.h/R_ext library and Rinternals.h. I tried rewriting the R interface but the problem keeps propagating. I've been told Gnumeric is a better gui library for working with R however, before I rewrite my entire program, is there an obvious solution to calling R functions in C++/qt? Thanks. Nancy ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ============================================================================= -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "NancyW" == Wong, Nancy Diana <nancy_wong at merck.com> writes:NancyW> I'm trying to write a gui program that accesses some NancyW> R code I've written. That gui might potentially be interesting to quite a few people! NancyW> The gui is written in c++ and NancyW> includes qt libraries and vigra libraries (for image NancyW> manipulation). Unfortunately I've been getting NancyW> dependencies due to constants getting redefined NancyW> within the R.h/R_ext library and Rinternals.h. here you should become more specific: Can you give your "#include" statements and the compiler (or linker?) error messages? Could it be that you include both Rdefines.h and Rinternals.h ? You should rather only use one of these; read the information on the topic in the "Writing R Extensions" Manual, in the "System and foreign language interfaces" part. NancyW> I tried rewriting the R interface but the problem NancyW> keeps propagating. I've been told Gnumeric is a NancyW> better gui library for working with R however, NancyW> before I rewrite my entire program, is there an NancyW> obvious solution to calling R functions in C++/qt? I think using R as plugin for GNumeric might be more widely useful (for the R community); but I guess this could be something quite a bit different from what you have in mind currently. I'm not the expert here at all, though. Regards, Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <>< -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 3 Jul 2002, Martin Maechler wrote:> >>>>> "NancyW" == Wong, Nancy Diana <nancy_wong@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.I think the definitions are different, and they are not #defines. This comes up all the time with Windows headers. Usually you need to include the one you do not need first, then #undef some conflicts and include the other. But qglobal is not using a #define, so you can I think use something like #include <qt.h> #define TRUE R_TRUE #define FALSE R_FALSE #include <R.h>> For R 1.6.0, we should try to prevent this (and the Qt > developers should too ..). > Proposals welcome.I don't see how, except via the above define trick. -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._