Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with RcppArmadillo and Rcpp when exporting .stanfunctions #127

Open
helske opened this issue Aug 3, 2024 · 0 comments
Open

Conflict with RcppArmadillo and Rcpp when exporting .stanfunctions #127

helske opened this issue Aug 3, 2024 · 0 comments

Comments

@helske
Copy link

helske commented Aug 3, 2024

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):

#include "packagename_types.h"
#include <RcppArmadillo.h>
#include <RcppEigen.h>
#include <Rcpp.h>

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant