在Qt 4.8.0中使用OpenCV 2.3.1时,应用程序在启动时崩溃

时间:2012-06-23 11:46:57

标签: qt opencv crash

我试图使用OpenCV功能控制我的相机。建设进度很好,但是,当我试图运行我的程序时崩溃,Qt只提供有关退出代码-1073741515的信息。我尝试使用OpenCV函数评论所有代码,程序似乎没问题。我包含的库是错误的吗?

opencv.pro

QT       += core gui

TARGET = opencv
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

INCLUDEPATH += F:/opencv/build/include
INCLUDEPATH += F:/opencv/build/include/opencv

LIBS += F:/opencv/build/x86/mingw/lib/libopencv_calib3d231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_contrib231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_core231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_features2d231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_flann231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_gpu231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_highgui231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_imgproc231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_legacy231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_ml231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_objdetect231.dll.a
LIBS += F:/opencv/build/x86/mingw/lib/libopencv_video231.dll.a

mainwindow.cpp

由于MainWindow.cpp很长,我只需在此处粘贴构造函数,并在需要时添加其余部分。

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    cam = NULL;
    frame = NULL;
    timer = new QTimer;
    imag = new QImage();
    connect(timer,SIGNAL(timeout()),this,SLOT(readFrame()));
    connect(ui->open,SIGNAL(clicked()),this,SLOT(openCamara()));
    connect(ui->pic,SIGNAL(clicked()),this,SLOT(takingPictures()));
    connect(ui->closeCam,SIGNAL(clicked()),this,SLOT(closeCamara()));
}

1 个答案:

答案 0 :(得分:0)

最后让它工作!当我尝试从Windows资源管理器运行该应用程序时,它抱怨缺少 libstdc ++ - 6.dll 。虽然在C:\ QtSDK \ mingw \ bin下存在,但它的版本对于OpenCV 2.3(或任何其他原因?)是不正确的,并且会导致错误。我从here得到一个,程序运行正常。