[Rcpp-devel] #ifdef'd out // [[Rcpp::export]]
Greg Minshall
minshall at umich.edu
Sun Feb 24 17:35:44 CET 2013
hi. first, i should mention that i think Rcpp is amazing! i'm enjoying
the learning process, and it speeds up my formerly-R code greatly.
(some trivial image processing thing that i was only doing in R in order
to combine two learning activities into one.)
but... ;-)
if i sourceCpp() the following code:
----
#include <Rcpp.h>
#if 0
// [[Rcpp::export]]
int foo() {
return 3;
}
#endif /* 0 */
----
i get this set of error messages
----
> sourceCpp("foo.cc")
foo.cc: In function 'SEXPREC* sourceCpp_15583_foo()':
foo.cc:16: error: 'foo' was not declared in this scope
make: *** [foo.o] Error 1
flag-sort -r g++ -I/sw/Library/Frameworks/R.framework/Versions/2.15/Resources/include -DNDEBUG -I/sw/include -I"/Users/minshall/Library/R/2.15/library/Rcpp/include" -fPIC -g -O2 -c foo.cc -o foo.o
Error in sourceCpp("foo.cc") : Error 1 occurred building shared library.
----
btw, thanks for pointing me at "verbose=TRUE" in sourceCpp(). i was
wondering how to get something like "g++ -E". (and, it shows me what's
going on under the hood in this case.)
cheers!
More information about the Rcpp-devel
mailing list