I wrote an R package using RcppArmadillo. In my source file, I had
#include <RcppArmadilloExtensions/sample.h>
in the first line, in order to use the function sample. The package was compiled and checked on my Windows machine, and submitted to CRAN. But it didn't check for the flavors: r-patched-solaris-sparc, r-patched-solaris-x86 with installation errors.
The log file showed
In file included from sim12.cpp:1:0: /home/R/Lib32/RcppArmadillo/include/RcppArmadilloExtensions/sample.h: In function ‘void Rcpp::RcppArmadillo::ProbSampleReplace(arma::uvec&, int, int, arma::vec&)’: /home/R/Lib32/RcppArmadillo/include/RcppArmadilloExtensions/sample.h:149:55: warning: ‘const arma::mtOp arma::sort_index(const arma::Base&, arma::uword) [with T1 = arma::Mat; typename T1::elem_type = double; arma::uword = unsigned int]’ is deprecated [-Wdeprecated-declarations] arma::uvec perm = arma::sort_index(prob, 1); //descending sort of index ^ In file included from /home/R/Lib32/RcppArmadillo/include/armadillo:449:0, from /home/R/Lib32/RcppArmadillo/include/RcppArmadilloForward.h:46, from /home/R/Lib32/RcppArmadillo/include/RcppArmadillo.h:31, from /home/R/Lib32/RcppArmadillo/include/RcppArmadilloExtensions/fixprob.h:25, from /home/R/Lib32/RcppArmadillo/include/RcppArmadilloExtensions/sample.h:30, from sim12.cpp:1: /home/R/Lib32/RcppArmadillo/include/armadillo_bits/fn_sort_index.hpp:37:1: note: declared here sort_index ^
and similar warnings.
To find out how to remedy this, I googled some part of the error messages and found this page (c-style and arma api change compile warning #203):
https://github.com/SMAC-Group/gmwm/issues/203
I believe that the installation error is not due to any particular line in my code following the first line
#include <RcppArmadilloExtensions/sample.h>
but I am not sure how I can resolve this issue. I'd be very grateful for any advice.
RcppArmadilloExtensions/sample.hto see what other packages are doing. - Dirk Eddelbuettel