Here is my R_API.cpp
#include "include/R_GatingSet.hpp"
#include <Rcpp.h>
Rcpp::List getPopCounts(Rcpp::XPtr<GatingSet> gsPtr, StringVec sampleNames, StringVec subpopulation, bool flowJo, bool isFullPath){
//do stuff
}
And here is RcppExports.cpp
generated by compileAttributes
#include <Rcpp.h>
using namespace Rcpp;
// getPopCounts
Rcpp::List getPopCounts(Rcpp::XPtr<GatingSet> gsPtr, StringVec sampleNames, StringVec subpopulation, bool flowJo, bool isFullPath);
RcppExport SEXP flowWorkspace_getPopCounts(SEXP gsPtrSEXP, SEXP sampleNamesSEXP, SEXP subpopulationSEXP, SEXP flowJoSEXP, SEXP isFullPathSEXP) {
BEGIN_RCPP
SEXP __sexp_result;
{
Rcpp::RNGScope __rngScope;
Rcpp::traits::input_parameter< Rcpp::XPtr<GatingSet> >::type gsPtr(gsPtrSEXP );
Rcpp::traits::input_parameter< StringVec >::type sampleNames(sampleNamesSEXP );
}
Apparently this fails the compiler because it misses the local header include (R_GatingSet.hpp
) that defines the user class GatingSet
.
g++ -I/home/wjiang2/R/r-devel/build/include -DNDEBUG -DROUT -Wno-deprecated -I/home/wjiang2/mylib/include/libxml2 -Ibst/ -I/usr/local/include -I"/home/wjiang2/R/r-devel/build/library/Rcpp/include" -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:9:36: error: ‘GatingSet’ was not declared in this scope
I wonder if there is better solution other than manually adding this include back to RcppExports.cpp
?
You should be able to handle this by having a header file of the same name as your package in (assuming the package is flowWorkspace
):
inst/include/flowWorkspace.h
compileAttributes
will include that header file in RcppExports.cpp
, and in there you could include the definitions of classes you need for the rest of the exports machinery to work.
EDIT: You could also try using the // [[Rcpp::interfaces(r, cpp)]]
attribute to auto-generate these interfaces for you (although I haven't played around with that as much), but it is discussed in the Rcpp Attributes vignette -- see 3.5.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With