<div dir="ltr">Hi Matt,<div><br></div><div> many thanks, I'm happy to see that there is a solution.</div><div><br></div><div>I was going to go through the armadillo source code, but I would never have </div><div>found the offending <span style="font-size:13px;font-family:arial,sans-serif">#if defined(__GXX_EXPERIMENTAL_</span><span style="font-size:13px;font-family:arial,sans-serif">CXX0X__).</span></div>

<div><span style="font-size:13px;font-family:arial,sans-serif"><br></span></div><div><font face="arial, sans-serif">Matteo</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 29, 2014 at 8:28 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On 29 May 2014 at 20:41, Matt D. wrote:<br>
| On 5/28/2014 23:58, Matteo Fasiolo wrote:<br>
|<br>
|     Dear Rcpp developers,<br>
|<br>
|      I am working on a package which uses Rcpp/RcppArmadillo, OpenMP and C++11.<br>
|<br>
|     Everything works fine under Linux: the package passes R CMD check<br>
|     --as-cran,<br>
|     while tests and vignettes work fine.<br>
|<br>
|     I uploaded the package on win-builder, but I keep getting the error at the<br>
|     bottom.<br>
|<br>
|     I have included the line CXX_STD = CXX11 in makefile.win as written in<br>
|     "Writing<br>
|     R extensions". I have read comments on SO regarding Rtools not supporting<br>
|     many C++11<br>
|     features. Is that the reason for the error or am I missing something?<br>
|<br>
| Hi, it's fixable! :-)<br>
|<br>
| I remember having to do that for RcppArmadillo 0.4.200.0.<br>
| Just updated to RcppArmadillo 0.4.300.0 and the issue still appears.<br>
|<br>
| There are two reasons (and thus two quick fixes):<br>
|<br>
| - "\RcppArmadillo\include\armadillo_bits\compiler_setup.hpp" forces the C++11<br>
| mode even when the compiler only supports experimental C++0x (this explains<br>
| your diagnostic messages);<br>
|<br>
| a simple fix is to comment out the offending preprocessor directives -- as in<br>
| the following:<br>
|<br>
|   //#if defined(__GXX_EXPERIMENTAL_CXX0X__)<br>
|   //  #undef  ARMA_USE_CXX11<br>
|   //  #define ARMA_USE_CXX11<br>
|   //#endif<br>
<br>
</div></div>Ack. I need to coordinate with Conrad to make this a little less binding.  He<br>
is tad busy right now but we should get there.  Maybe (for now) just using<br>
<br>
     #if defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(_WIN32)<br>
<br>
to protect ourselves from g++ 4.6.* is good enough?<br>
<div class=""><br>
| - "\RcppArmadillo\include\RcppArmadilloConfig.h" tries to detect Windows<br>
| environment and fails (as already noticed).<br>
| IMHO it fails for a good reason -- the guaranteed define is `_WIN32` and not<br>
| `WIN32`.<br>
|<br>
| // As Dirk noted the `WIN32` attempt is due to the choice made by R<br>
| implementers in the past. This doesn't change the fact that this choice is<br>
| wrong, IMHO -- the reason is that only the leading underscore (with certain<br>
| capitalization variants, also other names with `_t`, etc.) is guaranteed to<br>
| result in a name that is an implementation-reserved choice in C and C++. OTOH,<br>
| names like `WIN32` are not reserved and the users (client code) may feel free<br>
| to (re)define them as they like -- in particular, Windows users may freely `#<br>
| undef` it, while POSIX users may freely `#define` it -- and there's no reason<br>
| to say they would be "wrong" in doing so ;-)<br>
| //<br>
| // See:<br>
| // <a href="http://stackoverflow.com/questions/662084/" target="_blank">http://stackoverflow.com/questions/662084/</a><br>
| whats-the-difference-between-the-win32-and-win32-defines-in-c<br>
| // <a href="http://stackoverflow.com/questions/228783/" target="_blank">http://stackoverflow.com/questions/228783/</a><br>
| what-are-the-rules-about-using-an-underscore-in-a-c-identifier<br>
|<br>
| A better fix may be to fix the offending line in "RcppArmadilloConfig.h",<br>
| perhaps to something like the following:<br>
| #if defined(WIN32) || defined(_WIN32)<br>
<br>
</div>Yes, that is simpler than what I had committed in the meantime -- will adjust.<br>
<div class=""><br>
| After applying these fixes, an example from <a href="http://cran.r-project.org/web/" target="_blank">http://cran.r-project.org/web/</a><br>
| packages/Rcpp/vignettes/Rcpp-attributes.pdf (p.6; BTW, there's a small typo:<br>
| using-directive statement is missing a semicolon terminator) using<br>
| RcppArmadillo compiles without issues.<br>
<br>
</div>Thanks, added the semicolon too.<br>
<div class="HOEnZb"><div class="h5"><br>
Dirk<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</div></div></blockquote></div><br></div>