我开始在 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。