Re: [Rd] Accessing C++ code from R

2007-04-04 Thread Simon Urbanek
On Apr 4, 2007, at 2:46 PM, Jos Elkink wrote: > Thank you - that indeed fixes the first problem (about cout). It > still leaves the second error, though: > > main.cpp:52: error: brace-enclosed initializer used to initialize > 'R_NativePrimitiveArgType*' > > Any ideas about that? > Sure, do w

Re: [Rd] Accessing C++ code from R

2007-04-04 Thread Jos Elkink
Hi Simon, Thank you - that indeed fixes the first problem (about cout). It still leaves the second error, though: main.cpp:52: error: brace-enclosed initializer used to initialize 'R_NativePrimitiveArgType*' Any ideas about that? Thanks again for the first suggestion, anyway, and I'll keep your

Re: [Rd] Accessing C++ code from R

2007-04-04 Thread Simon Urbanek
Jos, you omitted the crucial part but my guess would be that all you have to do is to put #include *before* R headers includes (R defines "length" which throws off iostream). Also note that using cout is not a good idea, because it is not captured by R, you should be using Rprintf instead.

[Rd] Accessing C++ code from R

2007-04-04 Thread Jos Elkink
Hi, I am trying to use existing C++ code from R. I have no problems compiling C code and using it in R, but with C++ I'm running into problems. Here's the compiler output: Macintosh-10:~/Desktop/dissertation/Model - CPP version/R labguest$ g++ -I/Library/Frameworks/R.framework/Resources/include