as the release of OpenCV 2.3 is finally out, I wanted to compile and install this latest release on my system. As I often work with Qt and the QtCreator I of course wanted to be able to use it in my Qt projects. I've tried several methods now for some hours but always get errors:
First try: Compiling OpenCV 2.3 with WITH_QT
First I wanted to do it just like I did with the 2.2 release which worked fine for me. For this I followed this guide: http://knowtheabc.wordpress.com/2011/02/25/windows-opencv-and-qt-creator/
- Downloaded the source code
- Set up CMake and told it to create MInGW Makefiles and specified the paths to the
g++.exe
,gcc.exe
andqmake.exe
in my C:\Qt... paths, checked WITH_QT and generated Makefiles for a release. - Built and installed it in a shell using
mingw32-make
andmingw32-make install
After this was completed successfully, I just needed to add the paths to my ".pro" file and was able to build some nice software that uses OpenCV (back at the time where I used the 2.2 release). Basically the last part is described here: http://knowtheabc.wordpress.com/2011/02/25/opencv-in-qt/
So I tried the same with the 2.3 release which compiled successfully just as with the old release. It even builds my example program but as soon as I execute it, it closes again and returns: -1073741515
Second try: Using the pre-built OpenCV superpack using MinGW
As the first method didn't work I tried to use the pre-build versions. Though these don't have the WITH_QT enabled, I still wanted to try.
So I downloaded the superpack, extracted and put it somewhere. I then wanted to do the same as I did before and added the paths to the include folder and the dlls to my ".pro" file:
INCLUDEPATH+= C:/workspace/opencv/OpenCV2.3/build/include
LIBS+= C:/workspace/opencv/OpenCV2.3/build/x64/mingw/bin/*.dll
As compiler I used the MinGW compiler that comes with the current Qt SDK. But this crashes while building:
C:/workspace/opencv/OpenCV2.3/build/x64/mingw/bin/libopencv_calib3d230.dll: file not recognized: File format not recognized
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\CoinDetector.exe] Error 1
mingw32-make: *** [release] Error 2
Third try: Just like the second, but with using the VC2008 compiler
I tried the same thing with the vc2008 compiler that comes with the Qt SDK as well. So I selected the compiler and adapted the path in the ".pro" file to use:
LIBS+= C:/workspace/opencv/OpenCV2.3/build/x64/vc9/bin/*.dll
But this also crashes with an error that it can't read the dll:
C:/workspace/opencv/OpenCV2.3/build/x64/vc9/bin/opencv_calib3d230.dll : fatal error LNK1107: Ungültige oder beschädigte Datei: Lesen bei 0x2F0 nicht möglich.
So here my settings:
- Win7 Professional x64
- Latest Qt SDK installed (4.7.3)
- OpenCV 2.3 release
Does anybody have an idea what might be wrong here? Would be glad for any help!