c – 在窗口中使用带有qt的rinside
作者:互联网
我开始在c中使用rinside和rcpp.我只想从零开始,所以我的QT项目只有创建一个RInside实例,我有一个问题,我无法解决.我在项目中只有一个对话框表单.
我的项目文件:
QT += core gui
TARGET = rcpp-rinside
TEMPLATE = app
SOURCES += main.cpp\
dialog.cpp
HEADERS += dialog.h
FORMS += dialog.ui
INCLUDEPATH += C:\R\R-2.15.1\include
INCLUDEPATH += C:\R\R-2.15.1\library\Rcpp\include
INCLUDEPATH += C:\R\R-2.15.1\library\RInside\include
LIBS += -LC:\R\R-2.15.1\bin\i386 -lR
LIBS += -LC:\R\R-2.15.1\library\Rcpp\lib\i386\ -lRcpp
LIBS += -LC:\R\R-2.15.1\library\RInside\lib\i386\ -lRInside
主文件:
#include <QtGui/QApplication>
#include "dialog.h"
int main(int argc, char *argv[])
{
RInside R(argc, argv);
QApplication a(argc, argv);
Dialog w;
w.show();
return a.exec();
}
对于其他文件,没有任何内容,因为它只是一个空表单.
当我构建它时,我遇到了很多错误,如下所示:
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x39c): undefined reference to `__gxx_personality_sj0'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x3bb): undefined reference to `_Unwind_SjLj_Register'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x419): undefined reference to `_Unwind_SjLj_Unregister'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x471): undefined reference to `_Unwind_SjLj_Resume'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x4cc): undefined reference to `__gxx_personality_sj0'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x4eb): undefined reference to `_Unwind_SjLj_Register'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x608): undefined reference to `_Unwind_SjLj_Unregister'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x64c): undefined reference to `_Unwind_SjLj_Unregister'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x746): undefined reference to `_Unwind_SjLj_Unregister'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x7f6): undefined reference to `_Unwind_SjLj_Resume'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x84c): undefined reference to `__gxx_personality_sj0'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x86b): undefined reference to `_Unwind_SjLj_Register'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x8c6): undefined reference to `_Unwind_SjLj_Unregister'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x9c5): undefined reference to `_Unwind_SjLj_Resume'
C:\R\R-2.15.1\library\RInside\lib\i386\/libRInside.a(RInside.o):RInside.cpp:(.text+0x9ec): undefined reference to `__gxx_personality_sj0'
我使用的是R-2.15.1,RInside 0.2.7,Rcpp 0.9.10,QT 4.8.0,MinGW 4.6.1.
解决方法:
您必须使用与用于R的相同工具链构建的Qt版本 – 即编译器的MinGW构建.
从Qt源开始,我做了一次这样的概念验证.
除此之外,我强烈建议从我的RInside软件包示例附带的qtdensity.pro文件开始.
标签:c,r,qt,rcpp,rinside 来源: https://codeday.me/bug/20190729/1571447.html