C++ 在Linux中编译RInside示例失败

C++ 在Linux中编译RInside示例失败,c++,r,rinside,C++,R,Rinside,我正试图在Ubuntu软件包中的标准示例中使用RInside。我只是在安装了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/R

我正试图在Ubuntu软件包中的标准示例中使用RInside。我只是在安装了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\u module\u-sample0.cpp-L/usr/lib/R/R/lib-lblas-llpack-llpack-L/usr/local/R/site lib lib-lib-lib/RInside-Wl/RInside-lRInside-Wl-Wl-rpath、/rpath、/usr/local/lib/lib-rlinside-rl
在/usr/local/lib/R/site library/Rcpp/include/Rcpp.h:64:0中包含的文件中,
来自/usr/local/lib/R/site library/RInside/include/RInsideCommon.h:38,
来自/usr/local/lib/R/site library/RInside/include/RInside.h:26,
来自rinside_模块_样本0.cpp:7:
rinside_模块_sample0.cpp:在函数“int main(int,char**)”中:
/usr/local/lib/R/site library/Rcpp/include/Rcpp/Module.h:451:5:错误:未在此范围内声明“Shield”
屏蔽(加载)(模块)调用(Rf)lang2(获取模块(SYM),(rcpp)(模块)启动(NAME);\
^
rinside_模块_样本0.cpp:27:18:注意:在宏“LOAD_RCPP_模块”的扩展中
R[“bling”]=加载RCPP模块(bling);
^
/usr/local/lib/R/site library/Rcpp/include/Rcpp/Module.h:451:5:注:建议的备选方案:
屏蔽(加载)(模块)调用(Rf)lang2(获取模块(SYM),(rcpp)(模块)启动(NAME);\
^
rinside_模块_样本0.cpp:27:18:注意:在宏“LOAD_RCPP_模块”的扩展中
R[“bling”]=加载RCPP模块(bling);
^
在/usr/local/lib/R/site library/Rcpp/include/Rcpp/protection/protection.h:21:0中包含的文件中,
来自/usr/local/lib/R/site library/Rcpp/include/RcppCommon.h:129,
来自/usr/local/lib/R/site library/Rcpp/include/Rcpp.h:27,
来自/usr/local/lib/R/site library/RInside/include/RInsideCommon.h:38,
来自/usr/local/lib/R/site library/RInside/include/RInside.h:26,
来自rinside_模块_样本0.cpp:7:
/usr/local/lib/R/site library/Rcpp/include/Rcpp/protection/Shield.h:29:11:注意:“Rcpp::Shield”
阶级盾牌{
^
在/usr/local/lib/R/site library/Rcpp/include/Rcpp.h:64:0中包含的文件中,
来自/usr/local/lib/R/site library/RInside/include/RInsideCommon.h:38,
来自/usr/local/lib/R/site library/RInside/include/RInside.h:26,
来自rinside_模块_样本0.cpp:7:
/usr/local/lib/R/site library/Rcpp/include/Rcpp/Module.h:451:16:错误:在“>”标记之前应包含主表达式
屏蔽(加载)(模块)调用(Rf)lang2(获取模块(SYM),(rcpp)(模块)启动(NAME);\
^
rinside_模块_样本0.cpp:27:18:注意:在宏“LOAD_RCPP_模块”的扩展中
R[“bling”]=加载RCPP模块(bling);
^
/usr/local/lib/R/site library/Rcpp/include/Rcpp/Module.h:451:94:错误:在“;”标记之前应为“)”
屏蔽(加载)(模块)调用(Rf)lang2(获取模块(SYM),(rcpp)(模块)启动(NAME);\
^
rinside_模块_样本0.cpp:27:18:注意:在宏“LOAD_RCPP_模块”的扩展中
R[“bling”]=加载RCPP模块(bling);
^
/usr/local/lib/R/site library/Rcpp/include/Rcpp/Module.h:452:13:错误:“\uuuuu load\u Module\u call\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
射频评估(负载模块呼叫),射频全球电视;
^
rinside_模块_样本0.cpp:27:18:注意:在宏“LOAD_RCPP_模块”的扩展中
R[“bling”]=加载RCPP模块(bling);
^
/usr/local/lib/R/site library/Rcpp/include/Rcpp/Module.h:452:48:错误:应为“;”before')标记
射频评估(负载模块呼叫),射频全球电视;
^
rinside_模块_样本0.cpp:27:18:注意:在宏“LOAD_RCPP_模块”的扩展中
R[“bling”]=加载RCPP模块(bling);
^
make:**[rinside_模块_样本0]错误1

你的问题并没有说明你是如何启动编译的。RInside依赖于R和Rcpp,因此使用了一个中等复杂的Makefile。但是如果你只是这样做的话,事情应该是可行的。在我的Ubuntu 14.04系统上,使用git repo for RInside中的代码,该代码与你从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
,一切都应该构建。

你需要给我们更多的信息,而不仅仅是编译错误的转储。你使用的是什么版本的RInside和Ununtu?你使用的是什么版本的make和GCC?你采取了什么措施来修复失败的编译器吗在来这里之前,我做了些什么?这些步骤的结果是什么?谢谢你的回答。我在编程方面相对较新。我想我问这个问题的方式是错误的。关于我的操作系统的信息:gcc版本4.8.2(Ubuntu 4.8.2-19ubuntu1)、GNU Make 3.81、R版本3.0.2(2013-09-25),RInside 0.2.11和Ubuntu14.04。我只安装和卸载了RIside软件包很多次。我也尝试过将它们放在不同的路径中。但没有成功。由于我在编程方面的知识有限,我真的不知道现在该怎么办。希望这次我的问题更好。这是一个相当过度的向下投票。这是一个公平的选择问题,并合理清晰地张贴。嗨,德克,非常感谢你的回答。我只是停留在RInside/examples/standard目录中,并在终端中说make。我认为我按照标准步骤做所有事情。但似乎编译仍然不起作用。补充
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$