[Rcpp-devel] error: expected unqualified-id before string constant

JJ Allaire jj.allaire at gmail.com
Sun Feb 24 16:41:55 CET 2013

> I presume that the Rcpp-attributes vignette never ever shows RcppExport,
> and
> JJ probably did not assume it could be used.
> And it "really" is just an alias for the uglier-looking 'extern "C"'.  And
> of
> course added by the very layers that sourceCpp() puts around the code you
> give it... so you are pretty much expected not to put it there.  Does using
> verbose=TRUE help / give any hints?

> In my mind, the way to think about this is that sourceCpp() will compile
> and
> link the __C++ interface__ functions you give and provice __.Call()
> interfaces__
> by building wrappers.  You stuck something for the latter onto the former,
> things broke and you got to keep the pieces.

Yes, extern "C" aka the RcppExport macro has no place here. That's a macro
for use at the outer level of interop with R (which is taken care of for
you by sourceCpp). If you do as Dirk mentioned and specify verbose=TRUE
then you'll see that the stubs we generate from sourceCpp actually make
direct use of the RcppExport macro.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130224/26cb2f1d/attachment.html>

More information about the Rcpp-devel mailing list