I know... Another one of this... But no one else's error is the same as mine and I've been trying to build opencv with mingw32 for days now.
When building OpenCV with mingw the command mingw32-make
fails at some point trying to compile sources\modules\ts\src\ts_gtest.cpp
with error pic bellow:
I've tried following several tutorials, but none work cleanly and this is the best I could get stuff to work.
What I did:
- Installed Mingw and added
C:\Mingw\bin\
to PATH environment variable. - Installed CMake and added it too to PATH.
- Extracted OpenCV to
C:\
and created forlderC:\opencv\mingwBuild\
- In CMake-GUI I define source folder as
C:\opencv\sources\
and build folder asC:\opencv\mingwBuild\
. - Hit Configure and select
Mingw Makefiles
, with 'Use default native compilers' (have also specified compilers explicitly and the result is the same.). - Hit Generate, which creates the Makefile.
- I open
C:\Mingw\msys\1.0\msys.bat
to have a console with all variables loaded (have also tried directly from a simple cmd.exe, given that PATH is set for mingw, but I get the same error in compilation). Navigate toC:\opencv\mingwBuild\
and runmingw32-make
.
And that's where the error shows up after a while. Any ideas?
Turns ou gTest was not compiling in Mingw for some reason. As I don't intend to test my code (for now) I removed
opencv_ts
from instalation (by deselecting it in Cmake, after configuring and before generating).Someone mentions, in the first link @Dan Masek refers, that GTest has this issue with type conversion under mingw. They say that you can edit
ts_gtest.cpp
to apply the correct conversion, according to error message. That may be a solution if you need this module.Another comment in @Dan Masek's second link mentions that gcc's version 5 surpasses the issue, which version 4 has. So, getting a hold of such distro may also be a solution.