PDA

View Full Version : QtCreator and OpenCV, .dll missing



schludy
3rd December 2011, 11:37
Hey guys,

Sorry for the newb question, I'm really stuck and I don't now how to fix this problem:

I try to use OpenCV in QtCreator under Windows 7 and I can't get it working.
I use the .pro and .cpp file below, but when I press debug it shows me an error message: "During startup programm exited with code 0xc0000139."
I also tried with console, qmake && make, the .exe is created without error message, but when I want to run it, it says libopencv_highgui231.dll is missing. If it was missing, it couldn't create the .exe in the first place, right?
I tried putting the .dll in the .exe folder, run it and the message "The procedure entry point _ZNSt9exceptionD2Ev could not be located in the dynamic link library libstdc++-6.dll" appeared.
I have no clue what's happening. Any advice?

OpenCVtest.pro


TEMPLATE = app
QT -= gui
TARGET = SimpleCvApp

SOURCES += main.cpp

INCLUDEPATH += C:/OpenCV/opencv/modules/core/include \
C:/OpenCV/opencv/modules/highgui/include

# you can put the opencv .dll files where you want, this is where they are by default
# if you want to use different compiler or architecture, look for the libraries for your configuration in "OpenCV2.3/build" subfolder
LIBS += -L"C:/OpenCV/opencv/build/x86/mingw/bin"
LIBS += -lopencv_core231 -lopencv_highgui231


main.cpp


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

int main(){
cv::Mat image = cv::imread("C:/Users/shauri/Projects/OpenCVtest/test.jpg");
cv::namedWindow("My Image");
cv::imshow("My Image", image);
cv::waitKey(-1);
return 0;
}

Oleg
3rd December 2011, 14:15
It's a linking error, clean all, check paths and build again.

schludy
5th December 2011, 07:31
It's a linking error, clean all, check paths and build again.

Can you tell where the linking error is coming from?
The thing is, that qmake && make creates the .exe file without error, so I thought my linking is correct.
I've set these paths in the system variables:

Path=C:\QtSDK\mingw\bin; C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin

Is something missing?

Oleg
5th December 2011, 11:26
Sorry, but I don't remember why this error occurs (or even I didn't figure it out), just that fixing it was very simple after hours spent to hunt the reason. It is something wrong with OpenCV linking, not with your project.

schludy
5th December 2011, 15:37
It is something wrong with OpenCV linking, not with your project.

Thanks for the hint, that led me to the solution and this page:

http://stackoverflow.com/questions/6971883/qtcreator-and-opencv (http://opencv.willowgarage.com/wiki/MinGW)

Turns out, using opencv-superpack.exe and the .dll's in that folder is not doing the job.
Solution: Build OpenCV again, using cmake (step by step here: http://opencv.willowgarage.com/wiki/MinGW)

Now it's running, with only changing the first LIB to the new build!
Thanks again!