Trouble Integrating Qt 5.3.1 with OpenCV 2.4.9 (Solved)
I have looked and looked for an up to date tutorial for using OpenCV 2.4.9 with the newest release of Qt, and I have come up empty.
I have followed some tutorials but it seems as if because they are outdated, the setup does not work with the newest versions.
I am using windows 7 64bit with OpenCV 2.4.9, Qt 5.3.2, CMake 3.0.1, and MinGW 64bit compiler.
Before I share the error I keep getting, I will show what steps I have done.
After installing the above programs, I set the paths for both the compiler and cmake.
I opened cmake and used opencv/sources for the source and opencv/release for the new build files
(These steps were the same in the tutorials I used, and I didn't have a problem with them)
After configuring and generating the files successfully, I then used the mingw32-make command in the command prompt. This is where I keep getting the error.
Around the 30% mark, I keep getting an error when it tries to link the CXX shared library for the highgui249.dll. Other errors that show during this period are:
undefined reference to
_imp__ZN7Q...... bad reloc address 0x3a in section.text.......
recipe for target `modules/highgui/cmakefiles.....
I have looked for these errors with really no luck either.
Any help would be greatly appreciated!
Undefined reference is a linker error. Combined with bad reloc, this looks to me like a compiler incompatibility clash (or maybe MinGW bug). Are you compiling all the software using the same version (and architecture) of MinGW?
To my knowledge, yes.
Thanks for the reply.
To start, I just downloaded the Qt/MinGW pack that came together. This did not work. I then read that the MinGW compiler that came in the bundle was the 32bit version. I then uninstalled Qt and the downloaded Qt without the compiler and got the 64bit version. This also did not work. (All the time I was updating my variable paths)
I also came to the conclusion that it was either the compiler that wasn't working correctly, or that my OpenCV libraries weren't fully defined.
Every time I try something new, it fails at the same place when it tries to link the highgui249.dll libraries.
Hi and welcome to devnet,
Before going further, what compiler do you have installed ?
What Qt package did you install ?
Did you saw that OpenCV provides pre-built libraries for several compilers ? Did you select the right path when linking to the libraries ?
Compiler - MinGW 4.9.1 (32/64bit)
Qt - 5.3
OpenCV 2.4.9 only supplies pre-built libraries for vc10, vc11, and vc12 I believe.
And I am almost positive that I am using the right paths when linking the libraries, which is why I am so confused.
Then you will have to first compile OpenCV with your MinGW version
Alright, well then this might sounds like a dumb question, how do I do that?
"Here":http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html you have the instructions
I followed those instructions and was able to compile openCV with minGW using the -make and -install commands quite easily.
After that, am I suppose to do the same process over again but this time including the With_Qt libraries within Cmake?
Not necessarily, Qt is used in OpenCV for the highgui library to show controls etc. So if you don't use it in your software there's no need for that.
I figured it out. The cause was the wrong library being linked to CMake. With the new installer for 5.3.1, it opts to a default download of winrt_x64, and msvc2013_64.
You need to manually include mingw482_32 when downloading Qt and set the paths to C:\Qt\5.3\mingw482_32 (My path) so that when including the With_Qt, it finds the correct libraries.
Thanks for the help.
Nice you found out !
You're welcome !
Now that you have it working, please update the thread title prepending [solved] so other forum users may know a solution has been found :)