[Rcpp-devel] RcppProgress RcppArmadillo

bbonit at tin.it bbonit at tin.it
Tue Aug 13 13:50:15 CEST 2013


 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)
(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.


many thanks in advance 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130813/b8ed1b4e/attachment.html>


More information about the Rcpp-devel mailing list