Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/133.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ RInside编译:生成目标_C++_R_Rcpp_Rinside - Fatal编程技术网

C++ RInside编译:生成目标

C++ RInside编译:生成目标,c++,r,rcpp,rinside,C++,R,Rcpp,Rinside,我不熟悉使用make,我正在尝试运行此处给出的Qt density演示的RInside示例:。我已将代码保存到以下文件中: main.cpp 生成文件 qtdensity.cpp 包括/qt密度 我正在运行Ubuntu13.10,我安装了R、Rcpp和Inside。当我到终点站跑的时候 > make -f Makefile 我得到了错误 make: *** No targets. Stop. 请让我知道如何进行 多谢各位 我看不出如何跟进第一个答案,因此我必须扩展我的问题: 我刚刚创

我不熟悉使用make,我正在尝试运行此处给出的Qt density演示的RInside示例:。我已将代码保存到以下文件中:

main.cpp 生成文件 qtdensity.cpp 包括/qt密度

我正在运行Ubuntu13.10,我安装了R、Rcpp和Inside。当我到终点站跑的时候

> make -f Makefile
我得到了错误

make: *** No targets. Stop.
请让我知道如何进行

多谢各位


我看不出如何跟进第一个答案,因此我必须扩展我的问题:

我刚刚创建了这些文件,并能够在main.cpp、qtdesignity.cpp、qtdesignity.h和qtdesignity.pro上运行qmake,这些文件都正常工作,但当我尝试运行make时,出现以下错误:

很多与R相关的错误

qtdensity.cpp:(.text+0x53a): undefined reference to `Rf_mkString'
qtdensity.cpp:(.text+0x54e): undefined reference to `Rf_install'
qtdensity.cpp:(.text+0x559): undefined reference to `Rf_findVarInFrame'
qtdensity.cpp:(.text+0x560): undefined reference to `R_UnboundValue'
...

qtdensity.cpp:(.text.startup+0x2a5): undefined reference to `R_NaReal'
qtdensity.cpp:(.text.startup+0x2b2): undefined reference to `R_NaN'
main.o: In function `_GLOBAL__sub_I_main':
main.cpp:(.text.startup+0x2a5): undefined reference to `R_NaReal'
main.cpp:(.text.startup+0x2b2): undefined reference to `R_NaN'
main.o: In function `main':
main.cpp:(.text.startup+0x352): undefined reference to `RInside::RInside(int, char const* const*, bool, bool, bool)'
main.cpp:(.text.startup+0x397): undefined reference to `RInside::~RInside()'
main.cpp:(.text.startup+0x3b3): undefined reference to `RInside::~RInside()'
moc_qtdensity.o: In function `_GLOBAL__sub_I__ZN9QtDensity18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv':
moc_qtdensity.cpp:(.text.startup+0x2a5): undefined reference to `R_NaReal'
moc_qtdensity.cpp:(.text.startup+0x2b2): undefined reference to `R_NaN'
collect2: error: ld returned 1 exit status
make: *** [qdensity] Error 1

Qt示例不同,因为它使用Qt。您始终需要从.pro文件创建Makefile本身开始。证人:

edd@max:~/git/rinside/inst/examples/qt$ ls -l        ## no Makefile
total 28
drwxrwxr-x 2 edd edd 4096 Dec 27 18:38 cmake
-rw-rw-r-- 1 edd edd  518 Dec 27 18:38 main.cpp
-rw-rw-r-- 1 edd edd 5953 Dec 27 18:38 qtdensity.cpp
-rw-rw-r-- 1 edd edd 1532 Dec 27 18:38 qtdensity.h
-rw-rw-r-- 1 edd edd 2378 Feb 11 20:14 qtdensity.pro
-rw-rw-r-- 1 edd edd  887 Dec 27 18:38 README
edd@max:~/git/rinside/inst/examples/qt$ qmake        ## creates Makefile
edd@max:~/git/rinside/inst/examples/qt$ make
g++ -c -m64 -pipe -I/usr/share/R/include [... lots and lots omitted ...]
g++ -m64 -Wl,-O1 -o qtdensity qtdensity.o main.o moc_qtdensity.o  [....]
edd@max:~/git/rinside/inst/examples/qt$ ls -l qtdensity
-rwxrwxr-x 1 edd edd 76666 Feb 14 15:02 qtdensity
edd@max:~/git/rinside/inst/examples/qt$ 

这个当然在这个目录的自述文件中也有描述…

它没有与R或RInside链接。也许你的系统是非标准的。正如我向你展示的——在这里工作。