I am building a new package:
When I build the package using Rcmd INSTALL
, compileAttributes
is used behind the scene to automatically generate exported function,
RcppExport SEXP my.package_rcppfunction(...)
and I get a compilation error due to the dot in the exported name:
RcppExports.cpp:10:19: error: expected initializer before '.' token
As a workaround , I can change the package name to remove the dot from it , but I want better solution and to understand how the symbols are exported. So my question is:
I don't know if this can help , but here my g++ call:
g++ -m32 -I"PATH_TO_R/R-30~1.2/include" -DNDEBUG -
I"PATH_To_R/3.0/Rcpp/include" -
I"d:/RCompile/CRANpkg/extralibs64/local/include"
-O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
You can't do that -- the dot simply isn't allowed in a C or C++ function name:
Ie for
#include <stdlib.h>
int foo.bar(int x) {
return(2*x);
}
int main(void) {
foo.bar(21);
exit(0);
}
we get
edd@max:/tmp$ gcc -c foo.c
foo.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
foo.c: In function ‘main’:
foo.c:9: error: ‘foo’ undeclared (first use in this function)
foo.c:9: error: (Each undeclared identifier is reported only once
foo.c:9: error: for each function it appears in.)
edd@max:/tmp$
and
edd@max:/tmp$ g++ -c foo.c
foo.c:4: error: expected initializer before ‘.’ token
foo.c: In function ‘int main()’:
foo.c:9: error: ‘foo’ was not declared in this scope
edd@max:/tmp$
In C++, foo.bar()
is calling the member function bar()
of object foo
.
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