我正在构建一个新程序包:
当我使用编译程序包时Rcmd INSTALL
,该程序compileAttributes
被用于幕后自动生成导出的功能,
RcppExport SEXP my.package_rcppfunction(...)
并且由于导出名称中的点而收到编译错误:
RcppExports.cpp:10:19: error: expected initializer before '.' token
作为一种解决方法,我可以更改软件包名称以从中删除点,但是我想要更好的解决方案并了解如何导出符号。所以我的问题是:
我不知道这是否有帮助,但是在这里我的g ++调用:
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
您不能这样做-C或C ++函数名称中根本不允许使用点:
即
#include <stdlib.h>
int foo.bar(int x) {
return(2*x);
}
int main(void) {
foo.bar(21);
exit(0);
}
我们得到
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$
和
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$
在C ++中,foo.bar()
正在调用bar()
object的成员函数foo
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句