[Rcpp-devel] RcppProgress RcppArmadillo

Karl Forner - Quartz Bio karl.forner at quartzbio.com
Wed Nov 26 16:40:38 CET 2014


A bit late, but I've made some changes to RcppProgress to deal with the
RcppArmadillo header compatibility problem.
Please check https://github.com/kforner/rcpp_progress.
I added a note about RcppArmadillo in the package documentation.

Any feedback appreciated before CRAN resubmission.

Cheers,
Karl

On Tue, Aug 13, 2013 at 2:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 13 August 2013 at 13:50, bbonit at tin.it wrote:
> |  Dear list good morning,
> |  can someone explain why the compiler return me an error when I add the
> | following include
> | #include <progress.hpp> (without this inclusion the code is compiled in
> correct
> | way)
>
> I don't fully understand. If it is correct without it, but breaks with it
> --
> then why do you bother including it?
>
> | (using // [[Rcpp::depends(Rcpp,RcppArmadillo,RcppProgress)]] for
> dependencies)
> |
> | the example code (using attributes sourceCpp) :
> |
> |
> | // [[Rcpp::depends(Rcpp,RcppArmadillo,RcppProgress)]]
> |
> | #include <RcppArmadillo.h>
> | #include <RcppArmadilloExtensions/sample.h>
> |
> | #include <progress.hpp>
> |
> |
> | // [[Rcpp::export]]
> |
> | arma::vec Mahalanobis(arma::mat x, arma::rowvec center, arma::mat cov){
> |     int n = x.n_rows;
> |     arma::mat x_cen;
> |     x_cen.copy_size(x);
> |     for (int i=0; i < n; i++) {
> |         x_cen.row(i) = x.row(i) - center;
> |     }
> |     return sum((x_cen * cov.i()) % x_cen, 1);
> | }
> |
> |
> | require("Rcpp")
> | Sys.setenv("PKG_CXXFLAGS"="-fopenmp")
> | Sys.setenv("PKG_LIBS"="-fopenmp")
> |  sourceCpp("rr.cpp")
> |
> |
> | ERROR :
> | g++ -m32 -I"C:/PROGRA~1/R/R-30~1.1/include" -DNDEBUG
>  -I"C:/Users/gianni/
> | Documents/R/win-library/3.0/Rcpp/include" -I"C:/Users/gianni/Documents/R/
> | win-library/3.0/RcppArmadillo/include" -I"C:/Users/gianni/Documents/R/
> | win-library/3.0/RcppProgress/include"
> -I"d:/RCompile/CRANpkg/extralibs64/local
> | /include"  -fopenmp   -O2 -Wall  -mtune=core2 -c rr.cpp -o rr.o In file
> | included from rr.cpp:10:0: C:/Users/gianni/Documents/R/win-library/3.0/
> | RcppProgress/include/progress.hpp: In constructor
> 'Progress::Progress(long
> | unsigned int, bool)':
> C:/Users/gianni/Documents/R/win-library/3.0/RcppProgress/
> | include/progress.hpp:27:84: error: 'error' was not declared in this
> scope make:
> | *** [rr.o] Error 1
> | Errore in sourceCpp("rr.cpp") : Error 1 occurred building shared library.
>
> The R API (in C) uses renaming defines, so "error()" is sometimes / used to
> be "Rf_error()".
>
> I presume that the include order you have here has something to do with
> this:
> one file may have undefined it.  It may be as simple as moving the include
> for progress.hpp _above_ the othres.
>
> But what you have is more difficult to debug than it needs to be. I would
> try
> from just Rcpp, and adding one component at a time.
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20141126/2c628477/attachment.html>


More information about the Rcpp-devel mailing list