RcppEigen icon indicating copy to clipboard operation
RcppEigen copied to clipboard

Warn or error if Rcpp.h (and R.h) was included

Open eddelbuettel opened this issue 2 months ago • 0 comments

As discussed over in Rcpp in https://github.com/RcppCore/Rcpp/pull/1402 we are seeing some side effects from some package including R.h and later including possible also Rcpp.h and then RcppEigen.h leaving some of the masking of R's own error() function as Rf_error() to not be effective so that it later clashes with Eigen function error().

In general, it is always cleanest to just include RcppEigen.h as it does take care of both the others. For RcppArmadillo this once lead to issues to that it (very early on) switch to an actual compile error. We may do that one day but for now it might be a good idea to at least warn from RcppEigen.h if the header guards for either or both of Rcpp and R are seen.

eddelbuettel avatar Nov 05 '25 18:11 eddelbuettel