I'm writing a package with some functions calling RcppArmadillo::sample from RcppArmadillo. However I met the following error when compiling.
In file included from Citrus.cpp:2: ./R/x86_64-unknown-linux-gnu-library/3.0/RcppArmadillo/include/RcppArmadilloExtensions/sample.h: In function ‘T Rcpp::RcppArmadillo::sample(const T&, int, bool, Rcpp::NumericVector) [with T = arma::subview_col]’: Citrus.cpp:241: instantiated from here ./R/x86_64-unknown-linux-gnu-library/3.0/RcppArmadillo/include/RcppArmadilloExtensions/sample.h:45: error: ‘const struct arma::subview_col’ has no member named ‘size’ ./R/x86_64-unknown-linux-gnu-library/3.0/RcppArmadillo/include/RcppArmadilloExtensions/sample.h:48: error: no matching function for call to ‘arma::subview_col::subview_col(const int&)’ ./R/x86_64-unknown-linux-gnu-library/3.0/RcppArmadillo/include/armadillo_bits/subview_bones.hpp:236: note: candidates are: arma::subview_col::subview_col() [with eT = double] ./R/x86_64-unknown-linux-gnu-library/3.0/RcppArmadillo/include/armadillo_bits/subview_meat.hpp:2608: note: arma::subview_col::subview_col(const arma::Mat&, arma::uword, arma::uword, arma::uword) [with eT = double] ./R/x86_64-unknown-linux-gnu-library/3.0/RcppArmadillo/include/armadillo_bits/subview_meat.hpp:2597: note: arma::subview_col::subview_col(const arma::Mat&, arma::uword) [with eT = double] ./R/x86_64-unknown-linux-gnu library/3.0/RcppArmadillo/include/armadillo_bits/forward_bones.hpp:29: note: arma::subview_col::subview_col(const arma::subview_col&) make: *** [Citrus.o] Error 1
The RcppArmadillo I'm using is 0.7.700.0.0.
The same error appeared on both linux and OSX. When compiling using Rstudio, the error message as follows:
no member named 'size' in 'arma::subview_col<double>'.
no matching constructor for initialization of 'arma::subview_col<double>'
I used RcppArmadillo::sample in my previous work a lot. It suddenly doesn't work. I appreciate any help.
RcppArmadilloExtensions/sample.h
has lots of tests so I'm a bit skeptical here. – coatless