Why is OpenCV impossible to Build With QT on Visual Studio 2015

asked 2017-08-15 17:29:11 -0500

Hello, Im trying to build opencv with QT enabled.

I fllowed some of the steps in OpenCV tutorials, mainly here: https://wiki.qt.io/How_to_setup_Qt_an...

And I'm stuck because VS2015 is having hundreds of linking errors when trying to build OpenCV libraries.

I tried building 64 bit and 32 bit OpenCV, and the errors are still there.

I figure this is becasue Qt is built with a different compiler, older MSVC perhaps.

If I follow the instructions and build OpenCV with MinGW instead, it build everything correctly, except that I get .dll.a libraries instead of .lib libraries.

When It try to link the .a libraries in my application, I get more unresolved external symbols errors, such as:

Error LNK2019 unresolved external symbol "class cv::Mat __cdecl cv::imread(class cv::String const &,int)" (?imread@cv@@YA?AVMat@1@AEBVString@1@H@Z) referenced in function main

its my understanding that this may be the same compiler mismatch, this time propagated to building my application, instead of building OpenCV. And in order to use Qt with OpenCV, I will have to compile QT from source and OpenCV from Source.

Its a little frustrating that OpenCV doesn't bother to make this process any easier for their end users, or even offer any support. A lot of people use OpenCV with visual studio, but they are still unable to create simple UI elements Searching for solutions online only reveals how many users are having the same issues with QT

Building QT is also not a simple process and has a lot of its own issues. For now my solution is to abandon the useless QT framework and use the trusted Win32 API.

if somebody has any suggestions on how I can make OpenCV work with QT and Visual Studio 2015, I would appreciate it. Thanks,

edit retag flag offensive close merge delete