Hello,<br><br>I have run a couple more tests.<br><br>I commented out: #include <fstream><br><br>I then got the same error for #include <queue>, i.e:<br><br><br>In file included from /usr/include/c++/4.5/queue:65:0,<br>
from /home/simon/College/PackageOne/src/BZip/BZip.h:11,<br> from file21028e73.cpp:37:<br>/usr/include/c++/4.5/bits/stl_queue.h: In function SEXPREC* file21028e73(SEXPREC*, SEXPREC*):<br>
/usr/include/c++/4.5/bits/stl_queue.h:63:1: error: expected = before __attribute__<br>/usr/include/c++/4.5/bits/stl_queue.h:63:1: error: expected identifier before __attribute__<br>/usr/include/c++/4.5/bits/stl_queue.h:63:1: error: expected ; before __attribute__<br>
/usr/include/c++/4.5/bits/stl_queue.h:63:1: error: expected primary-expression before __attribute__<br>/usr/include/c++/4.5/bits/stl_queue.h:63:1: error: expected ; before __attribute__<br><br><br>I checked stl_queue.h, line 62: <br>
<br>GLIBCXX_BEGIN_NAMESPACE(std).<br><br>To be safe, I wrote a couple of quick codes that use the relevant includes, and these work fine when using g++ from the terminal, so I do not think that it is my c++ sources as such that are causing the problem, as far as I can ascertain myself. <br>
<br>Thanks again for all your help.<br><br><br><br><br><div class="gmail_quote">On Tue, Oct 11, 2011 at 10:10 AM, Simon Fuller <span dir="ltr"><<a href="mailto:simonfuller9@gmail.com">simonfuller9@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello Davor,<br><br>Yes, I think - I have:<br>#ifndef HEADERNAME_IN_CAPS<br>#define HEADERNAME_IN_CAPS 1<br>(..code..)<br>
#endif<br>for all my headers.<br><br>As far as I can tell the problem arises when fstream includes <div>
codecvt.h, which calls, on line 42:<br></div><br>_GLIBCXX_BEGIN_NAMESPACE(std)<br><br>I don't think this pertains to my own header includes, but I could very well be wrong.<br><br>Thanks,<br><font color="#888888"><br>
Simon</font><div><div></div><div class="h5"><br><br><br><div class="gmail_quote">
On Tue, Oct 11, 2011 at 5:27 AM, Davor Cubranic <span dir="ltr"><<a href="mailto:cubranic@stat.ubc.ca" target="_blank">cubranic@stat.ubc.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Simon,<br>
<br>
Are you wrapping your header file with an #ifndef to prevent it from being<br>
included multiple times?<br>
<br>
Davor<br>
<div><div></div><div><br>
<br>
On October 10, 2011 03:01:33 PM Simon Fuller wrote:<br>
> Hello,<br>
><br>
> I am getting some problems further down the line. It seems to happen when I<br>
> am including a std header in my own class, and when it itself includes a<br>
> header. Which suggests the problem is not with including headers in<br>
> general.<br>
><br>
> When it is reading my header, it gets this error in fstream:<br>
><br>
> In file included from /usr/include/c++/4.5/fstream:42:0,<br>
> from<br>
> /home/simon/College/PackageOne/src/MyClass/MyClass.h:6,<br>
> from file8ffc305.cpp:37:<br>
> /usr/include/c++/4.5/bits/codecvt.h: In function SEXPREC*<br>
> file8ffc305(SEXPREC*, SEXPREC*):<br>
> /usr/include/c++/4.5/bits/codecvt.h:42:1: error: expected = before<br>
> __attribute__<br>
> /usr/include/c++/4.5/bits/codecvt.h:42:1: error: expected identifier before<br>
> __attribute__<br>
> /usr/include/c++/4.5/bits/codecvt.h:42:1: error: expected ; before<br>
> __attribute__<br>
> /usr/include/c++/4.5/bits/codecvt.h:42:1: error: expected<br>
> primary-expression before __attribute__<br>
> /usr/include/c++/4.5/bits/codecvt.h:42:1: error: expected ; before<br>
> __attribute__<br>
><br>
> In fstream, line 42 is indeed: #include <bits/codecvt.h><br>
><br>
> I checked /usr/include/c++/4.5/bits/codecvt.h:42:1:<br>
><br>
> and this is line 42 of codecvt.h:<br>
><br>
> _GLIBCXX_BEGIN_NAMESPACE(std)<br>
><br>
> I googled this function, and I am wondering if it might be a compatibility<br>
> issue, as this sometimes seems to be cited in this regard in forums. I<br>
> really do not know myself. Has anyone any suggestions?<br>
><br>
> Thanks,<br>
><br>
> Simon<br>
><br>
><br>
><br>
><br>
> On Mon, Oct 10, 2011 at 11:09 AM, Simon Fuller<br>
> <<a href="mailto:simonfuller9@gmail.com" target="_blank">simonfuller9@gmail.com</a>>wrote:h<br>
><br>
> > Hello,<br>
> ><br>
> > I have just joined the mailing list.<br>
> ><br>
> > I was hoping you might be able to help me with a question.<br>
> ><br>
> > I am new to Rcpp, have some experience with both R and C++, but very<br>
> > little experience with integrating languages.<br>
> ><br>
> > I hope to use Rcpp to develop code over the next few years. However, to<br>
> > begin with, I have some preexisting C++ classes that I would like to make<br>
> > available to R.<br>
> ><br>
> > I have read the documentation that I can find, but I do not know which is<br>
> > the best approach to take.<br>
> ><br>
</div></div>> > I only, in principle, need *one method* to interact with the classes -<br>
<div><div></div><div>> > there then follows a fairly arduous process using different tree<br>
> > structures each of which have aggregate classes, but only a single<br>
> > double needs to be returned to R.<br>
> ><br>
> > I was therefore hoping to simply call a C++ wrapper function in-line,<br>
> > remotely, which in turn called my classes, but that does not work. I get<br>
> > an: "expected unqualified-id before extern " error after my includes,<br>
> > at: RcppExport SEXP.. at the start of my method declaration. (I can<br>
> > post code if this approach is not a complete dead end)<br>
> ><br>
> > So my two questions are: is there a quick way of prototyping this? i.e.<br>
> > to get R to invoke my classes through an rcpp intermediary.<br>
> ><br>
> > If there is not a quick way to do this, what is the best approach? Do I<br>
> > need to, and if so how do I, make my classes accessible to Rcpp. Because<br>
> > my whole hope here is to use preexisting code as swiftly as possible,<br>
> > 'easiest' and 'quickest' are almost synonyms for 'best' in my question.<br>
> ><br>
> > If someone could point me in the direction of some example code where<br>
> > Rcpp invokes user classes this would be great.<br>
> ><br>
> > My apologies if my question has been covered before, but I would really<br>
> > appreciate some advice on what is and is not possible, and some strategic<br>
> > advice on the best (easiest and quickest) approach.<br>
> ><br>
> > Thank you for your help. It is deeply appreciated.<br>
> ><br>
> > Simon<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>