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 _______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel