# Problem to compile OpenCV 2.4.3 with MinGW 4.4 for Windows XP

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Hello everyone, I have a problem to compile OpenCV 2.4.3 with MinGW 4.4 for Windows XP, I get the following message:

Linking CXX executable ..\..\bin\opencv_perf_core.exe
Info: resolving vtable for cv::_OutputArray by linking to __imp___ZTVN2cv12_Outp
utArrayE (auto-import)
Info: resolving vtable for cv::_InputArray by linking to __imp___ZTVN2cv11_Input
ArrayE (auto-import)
Info: resolving vtable for cv::Exception by linking to __imp___ZTVN2cv9Exception
E (auto-import)
Creating library file: ..\..\bin\libopencv_perf_core.dll.a
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: warning: a
uto-importing has been activated without --enable-auto-import specified on the c
ommand line.
This should work unless it involves constant data structures referencing symbols
from auto-imported DLLs.
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/opencv_perf_core.exe] Error 1
mingw32-make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
mingw32-make: *** [all] Error 2


What should I do ?

I noticed that OpenCV 2.4.3 for MinGW binaries do not go well, as creating a simple program with OpenCV 2.4.3 to display a jpg image (the compilation goes well, no errors) I get an error on libstdc++-6.dll . Hence my decision to recompile OpenCV 2.4.3 with MinGW 4.4

edit retag close merge delete

Sort by » oldest newest most voted

Hello

I had the same problem some weeks ago. I almost got mad. But fortunately I managed to solve it. It's a fault with your current MinGW setup. To solve this, you can either go directly to step 2 or, to ensure you'll success, rebuild OpenCV from the scratch:

1. Uninstall your current deployment of OpenCV + MinGW + other stuff you have installed. Ensure that all the folders are cleaned.

2. Install MingGW, but now ensure that you select Use pre-packaged repository catalogues when prompted with Repository catalogues on installer (look at the picture below).

3. Rebuild OpenCV + other stuff you have selected.

.

Now you should be able to compile successfully. If you choose Download latest repository catalogues instead of Use pre-packaged repository catalogues you will get the same error again. I can't understand why this botched job, but fortunately it can be circumvented.

more

( 2012-11-20 12:04:22 -0500 )edit

Dear all, I have a similar problem but, unfortunately, I do not have that option when installing minGW :(

I would like to use OpenCV 2.4.9 (or OpenCV 2.4.10) with minGW (I dl mingw-getversion0.6.2-beta-20131004-1), cmake-3.1.0-rc1-win32-x86 and Eclipse Luna (32 bit) on Windows 8.1.

I do NOT manage to build the binary files under OpenCV\build\x86\minGW.

These are my steps:

• I download minGW from http://sourceforge.net/projects/mingw/, there are only 3 installation steps, which are shown in the 3 pictures below the download button. When I install this minGW, it creates a dir minGW under C:. I add to the system PATH c:/mingw/bin.
• Download OpenCV 2.4.9, unzip it into C:. Under C:\ I have a dir called "opencv" storing 2 subdir "build" and "sources"; both of them are full of dir and files.
• I run CMake GUI tool from "C:\opencv\sources" to "C:\openCV\build\x86\minGW\lib" using MinGW Makefiles as the generator. Obs: Inside "C:\openCV\build\x86" there where 3 sub-dir vc10, vc11, vc12 which are pre-build for Microsoft Visual Studio. Since I plan to use Eclipse, I added the subdir minGW, which has been populated by the installer of minGW. The subdir lib is empty at the beginning.
• I open the command line, I go to the dir "C:\opencv\build\x86\mingw" and I run "mingw32-make".

This is the error message: [ 31%] Building CXX object modules/core/CMakeFiles/opencv_perf_core.dir/perf/per f_stat.cpp.obj Linking CXX executable ....\bin\opencv_perf_core.exe ../../lib/libopencv_ts249.a(ts_perf.cpp.obj):ts_perf.cpp:(.text.unlikely._ZN2cvl sERSoRKNS_3MatE+0x15): undefined reference to cv::Formatter::get(char const*)' ../../lib/libopencv_ts249.a(ts_perf.cpp.obj):ts_perf.cpp:(.text$_ZN12_GLOBAL__N_ 115PerfEnvironment8TearDownEv+0xb): undefined reference tocv::setNumThreads(in t)' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ../../lib/ libopencv_ts249.a(ts_perf.cpp.obj): bad reloc address 0xb in section `.text$_ZN1 2_GLOBAL__N_115PerfEnvironment8TearDownEv' collect2.exe: error: ld returned 1 exit status modules\core\CMakeFiles\opencv_perf_core.dir\build.make:535: recipe for target ' bin/opencv_perf_core.exe' failed mingw32-make[2]: * [bin/opencv_perf_core.exe] Error 1 CMakeFiles\Makefile2:1168: recipe for target 'modules/core/CMakeFiles/opencv_per f_core.dir/all' failed mingw32-make[1]: [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2 Makefile:136: recipe for target 'all' failed mingw32-make: ** [all] Error 2

I tried to use also minGW 64 bit (dl from http://sourceforge.net/projects/mingw-w64/files/) and it did NOT work at all: it install itself in a different place, I do not know exactly how to use it. Is it really necessary? I think it is easy to work with 32-bit software ...

I was working with OpenCV 2.4.10 (the last release), I switched to Open CV 2.4.9 because of the 32 bit issues. I cannot find anywhere info about these 32-64 bit problem. Can I use minGW 32 bit with ...

more

Official site

GitHub

Wiki

Documentation