[Rcpp-devel] C++ class methods exported via Interfaces Attribute?

Charles Determan cdetermanjr at gmail.com
Mon Aug 15 15:16:28 CEST 2016


Greetings,

I am trying to integrate some packages of mine so they can share some of
the same C++ functions (not exposed to the R front-end user).  Here is my
basic structure of the package I wish to export functions.

Class defined in header (foo.h) complete with all public and private
members.

Members defined in cpp file (foo.cpp).
This is also where I thought I could use the Rcpp::interfaces(cpp) function
generate the header file automatically (as I am not aware of a nice linking
operation between multiple package .so files).  So each method is prefixed
with //[[Rcpp::export]] for the package building.

I liked this approach because I wouldn't have to rewrite all my methods to
the header file manually.  However, this doesn't appear to be working.  I
am getting errors on the first method (I have tried only exporting one
method and I get the same error).


In file included from ../inst/include/gpuR.h:7:0,
                 from RcppExports.cpp:4:
../inst/include/gpuR_RcppExports.h:28:20: error: expected unqualified-id
before ‘<’ token
     inline template<typename T> dynEigenMat<T>::dynEigenMat(SEXP A_) {
                    ^
RcppExports.cpp:3313:1: error: expected ‘;’ at end of input
 }
 ^
RcppExports.cpp:3313:1: error: expected ‘}’ at end of input


Any insight would be appreciated.  Not sure if it is a problem with using
the template methods or if this means I simply have a typo somewhere (I
don't think so given that the code works without using the Rcpp interfaces
attribute.

Regards,
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160815/6358856a/attachment.html>


More information about the Rcpp-devel mailing list