Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Opencv setup with Qt
Hello, I am trying to run opencv program on Qt Creator 3.2.0, i have built and installed opencv libraries using Cmake and Qt mingw 5.4, but when i include path and libraries in the .pro file of the project, it gives this error:
"C:\opencv-mingw\install\include\opencv2\core\core.hpp:49: error: C1083: Cannot open include file: 'opencv2/core/types_c.h': No such file or directory"
Here is what i have included in the .pro of the project:
INCLUDEPATH += C:\opencv-mingw\install\javeria\opencv2
LIBS += -LC:\opencv-mingw\install\x64\mingw\bin
LIBS += -llibopencv_highgui2410
Looks like the path to OpenCV's includes are in
Also, please use the unix notation style for paths, otherwise you have to double your backslashes
The include part works but i cant declare a simple Mat object as it gives error while building like these:
main.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QEAAXXZ) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release@Mat@cv@@QEAAXXZ)
You are missing the OpenCV core library in your list of libraries to link to
This is the updated .pro file but its still giving same errors of unresolved externals:
INCLUDEPATH += C:/opencv-mingw/install/include
LIBS += -LC:/opencv-mingw/install/x64/mingw/bin/libopencv_core2410.dll.a
LIBS += -LC:/opencv-mingw/install/x64/mingw/lib/libopencv_highgui2410.dll.a
LIBS += -LC:/opencv-mingw/install/x64/mingw/lib/libopencv_core2410.dll.a
LIBS += -LC:/opencv-mingw/install/x64/mingw/lib/libopencv_imgproc2410.dll.a
Your original pro file was correct, just missing the opencv_core2410 library.
Now you are using the wrong l, L is for giving an additionnal path to the linker to search for libraries
I followed your instruction but now it says it can find for example "opencv_highgui.lib", is there something still missing?
So here is my finalized .pro file I have also added dll of bin too:
INCLUDEPATH += "C:/opencv/build/include" \
LIBS += -L"C:/opencv/build/x86/vc12/lib" \ -lopencv_core2410d \ -lopencv_highgui2410d \ -lopencv_imgproc2410d \ -lopencv_features2d2410d \ -lopencv_calib3d2410d LIBS += -L"C:/opencv/build/x86/vc12/bin" \ -lopencv_core2410d \ -lopencv_highgui2410d \ -lopencv_imgproc2410d \ -lopencv_features2d2410d \ -lopencv_calib3d2410d
It still gives unresolved external symbols error
boydcheung last edited by
So, anyone has succeeded in configuring opencv with Qt on Windows? I am using VS2013, and I found a demo for mingw, but an adjustment for vs just doesn't work well. It is always complaining about "No such file or directory" for including file:
C:\Users\vvv\Documents\github\OpenCV-With-QT-Quick-Demo\dialog.h:6: error: C1083: Cannot open include file: 'opencv2/core/core.hpp': No such file or directory
So frustrating tuned a whole morning without avail. Please show a working one.
LuGRU last edited by
Using OpenCV on Win for an app that do scene change detection based on threshold, OpenCV 3, compiled tonight OpenCV 2.x and also work fine.
Bottom line OpenCV do work correctly, with is not a surprise, with Qt.
boydcheung last edited by boydcheung