Sorry that I don't have a minimal example at the moment, but I can create one if needed.
I'm trying to export some Stan functions to R in a package which also includes C++ code using RcppArmadillo. I have a file Rexports.stanfunctions in inst/stan, but when installing the package I get an error "The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'.". This seems to be due to the incorrect order of including RcppArmadillo and Rcpp headers because in the autogenerated RcppExports.cpp file<packagename>_types.h is included first (such file is not created when there are no Stan functions to be exported):
The first include contains exporter.h from Rcpp which seems to mess things. Moving the first line to last after other includes seems to get rid of the error.
Sorry that I don't have a minimal example at the moment, but I can create one if needed.
I'm trying to export some Stan functions to R in a package which also includes C++ code using
RcppArmadillo
. I have a fileRexports.stanfunctions
ininst/stan
, but when installing the package I get an error"The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'."
. This seems to be due to the incorrect order of includingRcppArmadillo
andRcpp
headers because in the autogeneratedRcppExports.cpp
file<packagename>_types.h
is included first (such file is not created when there are no Stan functions to be exported):The first include contains
exporter.h
fromRcpp
which seems to mess things. Moving the first line to last after other includes seems to get rid of the error.