<div dir="ltr"><div><div>A bit late, but I've made some changes to <span class="">RcppProgress</span> to deal with the RcppArmadillo header compatibility problem.<br>Please check <a href="https://github.com/kforner/rcpp_progress" target="_blank">https://github.com/kforner/rcpp_progress</a>.<br>I added a note about RcppArmadillo in the package documentation.<br><br></div><div>Any feedback appreciated before CRAN resubmission. <br></div><div><br></div>Cheers,<br></div>Karl<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 13, 2013 at 2:17 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"><span class=""><br>
On 13 August 2013 at 13:50, <a href="mailto:bbonit@tin.it">bbonit@tin.it</a> wrote:<br>
|  Dear list good morning,<br>
|  can someone explain why the compiler return me an error when I add the<br>
| following include<br>
| #include <progress.hpp> (without this inclusion the code is compiled in correct<br>
| way)<br>
<br>
</span>I don't fully understand. If it is correct without it, but breaks with it --<br>
then why do you bother including it?<br>
<div><div class="h5"><br>
| (using // [[Rcpp::depends(Rcpp,RcppArmadillo,RcppProgress)]] for dependencies)<br>
|<br>
| the example code (using attributes sourceCpp) :<br>
|<br>
|<br>
| // [[Rcpp::depends(Rcpp,RcppArmadillo,RcppProgress)]]<br>
|<br>
| #include <RcppArmadillo.h><br>
| #include <RcppArmadilloExtensions/sample.h><br>
|<br>
| #include <progress.hpp><br>
|<br>
|<br>
| // [[Rcpp::export]]<br>
|<br>
| arma::vec Mahalanobis(arma::mat x, arma::rowvec center, arma::mat cov){<br>
|     int n = x.n_rows;<br>
|     arma::mat x_cen;<br>
|     x_cen.copy_size(x);<br>
|     for (int i=0; i < n; i++) {<br>
|         x_cen.row(i) = x.row(i) - center;<br>
|     }<br>
|     return sum((x_cen * cov.i()) % x_cen, 1);<br>
| }<br>
|<br>
|<br>
| require("Rcpp")<br>
| Sys.setenv("PKG_CXXFLAGS"="-fopenmp")<br>
| Sys.setenv("PKG_LIBS"="-fopenmp")<br>
|  sourceCpp("rr.cpp")<br>
|<br>
|<br>
| ERROR :<br>
| g++ -m32 -I"C:/PROGRA~1/R/R-30~1.1/include" -DNDEBUG     -I"C:/Users/gianni/<br>
| Documents/R/win-library/3.0/Rcpp/include" -I"C:/Users/gianni/Documents/R/<br>
| win-library/3.0/RcppArmadillo/include" -I"C:/Users/gianni/Documents/R/<br>
| win-library/3.0/RcppProgress/include"  -I"d:/RCompile/CRANpkg/extralibs64/local<br>
| /include"  -fopenmp   -O2 -Wall  -mtune=core2 -c rr.cpp -o rr.o In file<br>
| included from rr.cpp:10:0: C:/Users/gianni/Documents/R/win-library/3.0/<br>
| RcppProgress/include/progress.hpp: In constructor 'Progress::Progress(long<br>
| unsigned int, bool)': C:/Users/gianni/Documents/R/win-library/3.0/RcppProgress/<br>
| include/progress.hpp:27:84: error: 'error' was not declared in this scope make:<br>
| *** [rr.o] Error 1<br>
| Errore in sourceCpp("rr.cpp") : Error 1 occurred building shared library.<br>
<br>
</div></div>The R API (in C) uses renaming defines, so "error()" is sometimes / used to<br>
be "Rf_error()".<br>
<br>
I presume that the include order you have here has something to do with this:<br>
one file may have undefined it.  It may be as simple as moving the include<br>
for progress.hpp _above_ the othres.<br>
<br>
But what you have is more difficult to debug than it needs to be. I would try<br>
from just Rcpp, and adding one component at a time.<br>
<span class="HOEnZb"><font color="#888888"><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>
</font></span></blockquote></div><br></div>