OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64bits Windows 7 - “退出代码 -1073741515”

Posted

技术标签:

【中文标题】OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64bits Windows 7 - “退出代码 -1073741515”【英文标题】:OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64bits Windows 7 - "exited with code -1073741515" 【发布时间】:2015-02-26 14:50:01 【问题描述】:

我已编译 OpenCV 2.4.10 以与 Qt 5.4 mingw 一起使用 64 位。当我编译加载图片的最基本示例时,它会出现以下错误:

退出代码 -1073741515

有谁知道这意味着什么以及我该如何解决?

QT      += core
QT      += gui
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

TEMPLATE = app

SOURCES += main.cpp

INCLUDEPATH += C://opencv2_build//install//include
LIBS += C://opencv2_build//bin//*.dll

【问题讨论】:

【参考方案1】:

错误代码表示“缺少依赖项”。 QT 中 OpenCV 的工作配置应如下所示:

LIBS += -LC:\\Programs\\opencv24\\opencv_bin2\\bin \
    libopencv_core240d \
    libopencv_highgui240d \
    libopencv_imgproc240d \
    libopencv_features2d240d \
    libopencv_calib3d240d \

来源:here

【讨论】:

谢谢你们,两个答案都解决了我的问题。非常感谢。【参考方案2】:

看起来像一个错误,您没有正确链接 OpenCV。这是如何正确链接应用程序的示例(将其放入 .pro 文件中):

win32 
    OPENCV_LIB_DIR = $$PWD/libs/opencv/Windows
    INCLUDEPATH += $$PWD/include/opencv/Windows


linux 
    OPENCV_LIB_DIR = $$PWD/libs/opencv/Linux
    INCLUDEPATH += $$PWD/include/opencv/Linux
    LIBS += -L$$OPENCV_LIB_DIR


message(OpenCV Library directory: $$OPENCV_LIB_DIR)
LIBS += -L$$OPENCV_LIB_DIR

win32 
    LIBS += -lopencv_core248
    LIBS += -lopencv_calib3d248
    LIBS += -lopencv_contrib248
    LIBS += -lopencv_features2d248
    LIBS += -lopencv_flann248
    LIBS += -lopencv_gpu248
    LIBS += -lopencv_highgui248
    LIBS += -lopencv_imgproc248
    LIBS += -lopencv_legacy248
    LIBS += -lopencv_ml248
    LIBS += -lopencv_nonfree248
    LIBS += -lopencv_objdetect248
    LIBS += -lopencv_ocl248
    LIBS += -lopencv_photo248
    LIBS += -lopencv_stitching248
    LIBS += -lopencv_superres248
    LIBS += -lopencv_video248
    LIBS += -lopencv_videostab248



linux 
    LIBS += -lopencv_core
    LIBS += -lopencv_calib3d
    LIBS += -lopencv_contrib
    LIBS += -lopencv_cuda
    LIBS += -lopencv_cudaarithm
    LIBS += -lopencv_cudabgsegm
    LIBS += -lopencv_cudacodec
    LIBS += -lopencv_cudafeatures2d
    LIBS += -lopencv_cudafilters
    LIBS += -lopencv_cudaimgproc
    LIBS += -lopencv_cudaoptflow
    LIBS += -lopencv_cudastereo
    LIBS += -lopencv_cudawarping
    LIBS += -lopencv_features2d
    LIBS += -lopencv_flann
    LIBS += -lopencv_highgui
    LIBS += -lopencv_imgproc
    LIBS += -lopencv_legacy
    LIBS += -lopencv_ml
    LIBS += -lopencv_nonfree
    LIBS += -lopencv_objdetect
    LIBS += -lopencv_optim
    LIBS += -lopencv_photo
    LIBS += -lopencv_shape
    LIBS += -lopencv_softcascade
    LIBS += -lopencv_stitching
    LIBS += -lopencv_superres
    LIBS += -lopencv_ts
    LIBS += -lopencv_video
    LIBS += -lopencv_videostab

请注意,我使用-L 标志来告诉库文件夹是什么,然后使用-l 标志来针对每个 DLL (Windows) 或 .so (Linux)。关于您实际想要如何链接库,您有几个不同的选择,但这种方法对我有用。希望这会有所帮助!

【讨论】:

以上是关于OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64bits Windows 7 - “退出代码 -1073741515”的主要内容,如果未能解决你的问题,请参考以下文章

QT下opencv的编译和使用

Visual Studio 2010下的OpenCV 2.4.10安装过程

在 Qt Android 项目中使用 OpenCV 时的链接顺序 [重复]

图像识别(11)——LED灯光点捕获+基于QT平台绘制轨迹

Qt Creator 调试器未显示返回值

Opencv 2.4.10 +VS2010 项目配置记录