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\binLIBS += -llibopencv_highgui2410
-llibopencv_imgproc2410
-llibopencv_objdetect2410 -
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:
win32
{
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 -
So here is my finalized .pro file I have also added dll of bin too:
win32 {
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 -
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.
-
@boydcheung okay, this vid here gives a clue. Run Qmake before debugging.