Closed. This question is off-topic。它当前不接受答案。
想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
5年前关闭。
我正在尝试将RInside与Ubuntu包中的标准示例一起使用。安装后,我只是在RInside的源代码中使用了make命令。
有关我的操作系统的信息:gcc版本4.8.2(Ubuntu 4.8.2-19ubuntu1),GNU Make 3.81,R版本3.0.2(2013-09-25),RInside 0.2.11和Ubuntu 14.04。
这是编译错误。谁能帮我 ? :)
自从我更改了R的Debian / Ubuntu软件包以反映许多内容以来,这非常冗长
默认的强化标志,此外,我们还需要一些头文件和库。
但是最主要的是:只要在examples目录中说
想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
5年前关闭。
我正在尝试将RInside与Ubuntu包中的标准示例一起使用。安装后,我只是在RInside的源代码中使用了make命令。
有关我的操作系统的信息:gcc版本4.8.2(Ubuntu 4.8.2-19ubuntu1),GNU Make 3.81,R版本3.0.2(2013-09-25),RInside 0.2.11和Ubuntu 14.04。
这是编译错误。谁能帮我 ? :)
g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O3 -pipe -g -Wall rinside_module_sample0.cpp -L/usr/lib/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_module_sample0
In file included from /usr/local/lib/R/site-library/Rcpp/include/Rcpp.h:64:0,
from /usr/local/lib/R/site-library/RInside/include/RInsideCommon.h:38,
from /usr/local/lib/R/site-library/RInside/include/RInside.h:26,
from rinside_module_sample0.cpp:7:
rinside_module_sample0.cpp: In function ‘int main(int, char**)’:
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/Module.h:451:5: error: ‘Shield’ was not declared in this scope
Shield<SEXP> __load_module_call__( Rf_lang2( GET_MODULE_SYM, _rcpp_module_boot_##NAME() ); \
^
rinside_module_sample0.cpp:27:18: note: in expansion of macro ‘LOAD_RCPP_MODULE’
R["bling"] = LOAD_RCPP_MODULE(bling) ;
^
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/Module.h:451:5: note: suggested alternative:
Shield<SEXP> __load_module_call__( Rf_lang2( GET_MODULE_SYM, _rcpp_module_boot_##NAME() ); \
^
rinside_module_sample0.cpp:27:18: note: in expansion of macro ‘LOAD_RCPP_MODULE’
R["bling"] = LOAD_RCPP_MODULE(bling) ;
^
In file included from /usr/local/lib/R/site-library/Rcpp/include/Rcpp/protection/protection.h:21:0,
from /usr/local/lib/R/site-library/Rcpp/include/RcppCommon.h:129,
from /usr/local/lib/R/site-library/Rcpp/include/Rcpp.h:27,
from /usr/local/lib/R/site-library/RInside/include/RInsideCommon.h:38,
from /usr/local/lib/R/site-library/RInside/include/RInside.h:26,
from rinside_module_sample0.cpp:7:
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/protection/Shield.h:29:11: note: ‘Rcpp::Shield’
class Shield{
^
In file included from /usr/local/lib/R/site-library/Rcpp/include/Rcpp.h:64:0,
from /usr/local/lib/R/site-library/RInside/include/RInsideCommon.h:38,
from /usr/local/lib/R/site-library/RInside/include/RInside.h:26,
from rinside_module_sample0.cpp:7:
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/Module.h:451:16: error: expected primary-expression before ‘>’ token
Shield<SEXP> __load_module_call__( Rf_lang2( GET_MODULE_SYM, _rcpp_module_boot_##NAME() ); \
^
rinside_module_sample0.cpp:27:18: note: in expansion of macro ‘LOAD_RCPP_MODULE’
R["bling"] = LOAD_RCPP_MODULE(bling) ;
^
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/Module.h:451:94: error: expected ‘)’ before ‘;’ token
Shield<SEXP> __load_module_call__( Rf_lang2( GET_MODULE_SYM, _rcpp_module_boot_##NAME() ); \
^
rinside_module_sample0.cpp:27:18: note: in expansion of macro ‘LOAD_RCPP_MODULE’
R["bling"] = LOAD_RCPP_MODULE(bling) ;
^
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/Module.h:452:13: error: ‘__load_module_call__’ was not declared in this scope
Rf_eval(__load_module_call__), R_GlobalEnv );
^
rinside_module_sample0.cpp:27:18: note: in expansion of macro ‘LOAD_RCPP_MODULE’
R["bling"] = LOAD_RCPP_MODULE(bling) ;
^
/usr/local/lib/R/site-library/Rcpp/include/Rcpp/Module.h:452:48: error: expected ‘;’ before ‘)’ token
Rf_eval(__load_module_call__), R_GlobalEnv );
^
rinside_module_sample0.cpp:27:18: note: in expansion of macro ‘LOAD_RCPP_MODULE’
R["bling"] = LOAD_RCPP_MODULE(bling) ;
^
make: *** [rinside_module_sample0] Error 1
最佳答案
您的问题没有显示您如何启动编译。 RInside依赖于R和Rcpp,因此使用中等复杂的Makefile。但是,如果您只是认为事情应该起作用。在我的Ubuntu 14.04系统上,并使用Rinside的git repo中的代码,该代码与从CRAN获取的软件包一起安装:
edd@max:~$ cd git/rinside/inst/examples/standard/
edd@max:~/git/rinside/inst/examples/standard$ make rinside_sample0
g++-4.8 -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include \
-I/usr/local/lib/R/site-library/RInside/include -g -O2 -fstack-protector \
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 \
-g -O3 -Wall -pipe -Wno-unused -pedantic -Wall \
rinside_sample0.cpp -Wl,--export-dynamic -fopenmp -L/usr/lib/R/lib \
-lR -lpcre -llzma -lbz2 -lz -lrt -ldl -lm -lblas -llapack \
-L/usr/local/lib/R/site-library/RInside/lib \
-lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib \
-o rinside_sample0
edd@max:~/git/rinside/inst/examples/standard$ ./rinside_sample0
Hello, world!
edd@max:~/git/rinside/inst/examples/standard$
自从我更改了R的Debian / Ubuntu软件包以反映许多内容以来,这非常冗长
默认的强化标志,此外,我们还需要一些头文件和库。
但是最主要的是:只要在examples目录中说
make
,一切都应该构建。关于c++ - 在Linux中无法编译RInside示例,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24921628/
10-12 20:39