0

What i want to do

I try to use opencv and run a short example program.

Problem

It exits with code -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.

I had diffrenet errors using different attempts (undefined reference, crashing programm without error code, etc.), this here is the just simplest example.

What i figured out

Another post told me, that -1073741515 is equal to 0xC0000135 meaning 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>. When i comment them out, it runs wnd returns 0 as intended. I don't even need to use anything like cv::Mat or something to make it crash. That seems strange, because the code completion suggests me stuff from openCV, so it somehow sees it. Including #include <opencv2/opencv.hpp> instead leads to the same error code. Including something beginning with opencv (not opencv2) works, for example #include <opencv/cv.hpp>, but has not enough functionality.

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:

include path

libs:

libs

project:

project

build (copied the libs to the release/debug folders too):

build

Versions

  • QT 5.10.1
  • MSVC17 64bit Compiler
  • Windows 7 Enterprise 64bit
  • openCV 3.4.3 (vc14/vc15)
Kemendil
  • 121
  • 1
  • 11
  • Where is opencv_world343.dll? If it's not static build, need put the dlls in `build-xxx-debug` folder – JustWe Sep 04 '18 at 08:18
  • LIBS += -LD:/opencv/build/x64/vc14/lib shoud be "vc15", link to xxxd.lib only in debug and to xxx.lib only in release, and need to put .dll into the same folder as the exe – Miki Sep 04 '18 at 09:26
  • Thanks Jiu :-) it works, if i copy the .dll instead of .lib. Thanks Miki: I tried both vc14 and vc15, that didn't solve my problem. Thanks for the hint where to put it. – Kemendil Sep 04 '18 at 09:29

1 Answers1

0

As Jiu pointed out in the comment above, the solution was simple:

Copy the .dll not the .lib and it works.

Kemendil
  • 121
  • 1
  • 11