简体   繁体   English

Qt OpenCV程序退出,代码为-1073741515

[英]Qt OpenCV programm exits with code -1073741515

What i want to do 我想做的事

I try to use opencv and run a short example program. 我尝试使用opencv并运行一个简短的示例程序。

Problem 问题

It exits with code -1073741515 . 它以代码-1073741515退出。 I never managed to use openCV on any of the 4 systems i tried, so i do something wrong but don't know what. 我从未尝试在尝试的4个系统中的任何一个上使用openCV,所以我做错了什么,但不知道是什么。

I had diffrenet errors using different attempts (undefined reference, crashing programm without error code, etc.), this here is the just simplest example. 我使用不同的尝试(未定义的引用,崩溃的程序且没有错误代码等)遇到了diffrenet错误,这是最简单的示例。

What i figured out 我发现了什么

Another post told me, that -1073741515 is equal to 0xC0000135 meaning STATUS_DLL_NOT_FOUND . 另一则帖子告诉我, -1073741515等于0xC0000135表示STATUS_DLL_NOT_FOUND

What i tried 我尝试了什么

The programm crashes, if include #include <opencv2/core/core.hpp> , #include <opencv2/highgui/highgui.hpp> and #include <opencv2/imgproc/imgproc.hpp> . 如果包含#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc/imgproc.hpp> ,则程序崩溃。 When i comment them out, it runs wnd returns 0 as intended. 当我注释掉它们时,它将运行wnd返回预期的0。 I don't even need to use anything like cv::Mat or something to make it crash. 我什至不需要使用cv::Mat东西或使其崩溃。 That seems strange, because the code completion suggests me stuff from openCV, so it somehow sees it. 这似乎很奇怪,因为代码完成会向我推荐来自openCV的内容,因此可以通过某种方式看到它。 Including #include <opencv2/opencv.hpp> instead leads to the same error code. 包含#include <opencv2/opencv.hpp>会导致相同的错误代码。 Including something beginning with opencv (not opencv2) works, for example #include <opencv/cv.hpp> , but has not enough functionality. 包括以opencv开头的内容(不是opencv2)是可以的,例如#include <opencv/cv.hpp> ,但功能不足。

Source file 源文件

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

#include <iostream>
using namespace std;

int main()
{
    cv::Mat InputImage = cv::imread("C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg");

    if(!InputImage.empty())
        cv::imshow("test", InputImage);
    else
        cout << "imgage is empty" << endl;

    return 0;
}

Project file 项目文件

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt

INCLUDEPATH += D:/opencv/build/include
LIBS += -LD:/opencv/build/x64/vc14/lib
LIBS += -lopencv_world343d
LIBS += -lopencv_world343

SOURCES += \
        main.cpp

Relevant folders 相关文件夹

Include path: 包含路径:

包含路径

libs: 库:

库

project: 项目:

项目

build (copied the libs to the release/debug folders too): 构建(也将库复制到release / debug文件夹):

建立

Versions 版本

  • QT 5.10.1 QT 5.10.1
  • MSVC17 64bit Compiler MSVC17 64位编译器
  • Windows 7 Enterprise 64bit Windows 7企业版64位
  • openCV 3.4.3 (vc14/vc15) openCV 3.4.3(vc14 / vc15)

As Jiu pointed out in the comment above, the solution was simple: 正如Jiu在上面的评论中指出的那样,解决方案很简单:

Copy the .dll not the .lib and it works. 复制.dll而不是.lib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM