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

Greg Minshall minshall at umich.edu
Sun Feb 24 15:56:49 CET 2013


hi.  another "find" in experimenting is that [[Rcpp::export]] and the
RcppExport (in, e.g.,
----
// [[Rcpp::export]]
RcppExport SEXP pass1(Rcpp::IntegerVector rgbtotype,
                      Rcpp::IntegerMatrix pixmap,
                      int toosmall) {...}
----
are mutually exclusive.  that's probably a "duh!", but it kept me
blissfully confused for an entertaining hour or four.  here is the
longer version of the error message when compiling:
----
> sourceCpp("cluster.cc")
cluster.cc: In function 'SEXPREC* sourceCpp_54257_pass1(SEXPREC*, SEXPREC*, SEXPREC*)':
cluster.cc:438: error: expected unqualified-id before string constant
cluster.cc:439: error: '__result' was not declared in this scope
make: *** [cluster.o] Error 1
----

(just to be clear: you can have either one, or the other, but not both.)

(i suppose [[Rcpp::export]] *could* redefine RcppExport to NULL, which
might help the unwary.)

cheers, Greg


More information about the Rcpp-devel mailing list