OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64 位 Windows 7 - "exited with code -1073741515"

OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64bits Windows 7 - "exited with code -1073741515"

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

exited with code -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

错误代码表示"Dependency missing"。 QT 中 OpenCV 的工作配置应如下所示:

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

来源:here

看起来像是一个错误,您没有 link 正确地使用 OpenCV。这是一个如何正确 link 您的应用程序的示例(将其放入您的 .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).关于您实际想要 link 图书馆的方式,您有几种不同的选择,但这种方法对我有用。希望这对您有所帮助!