I'm trying to compile OpenCV 2.4.8 on Windows 8 with mingw but got stuck on this errors:
[ 36%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/win
dow_w32.cpp.obj
cd /d C:\Users\HM\Downloads\opencv-2.4.8\opencv\buildMingW32\modules\highgui &&
C:\MinGW\bin\g++.exe -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -fsigned-char -mstackre
align -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wform
at -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-
arith -Wshadow -Wsign-promo -fdiagnostics-show-option -march=i686 -fomit-frame-p
ointer -msse -msse2 -mfpmath=sse -ffunction-sections -Wno-deprecated-declaration
s -O2 -DNDEBUG -DNDEBUG @CMakeFiles/opencv_highgui.dir/includes_CXX.rsp -inc
lude "C:/Users/HM/Downloads/opencv-2.4.8/opencv/buildMingW32/modules/highgui/pre
comp.hpp" -Winvalid-pch -o CMakeFiles\opencv_highgui.dir\src\window_w32.cpp.obj
-c C:\Users\HM\Downloads\opencv-2.4.8\opencv\sources\modules\highgui\src\window
_w32.cpp
C:\Users\HM\Downloads\opencv-2.4.8\opencv\sources\modules\highgui\src\window_w32
.cpp: In function 'void cvSetModeWindow_W32(const char*, double)':
C:\Users\HM\Downloads\opencv-2.4.8\opencv\sources\modules\highgui\src\window_w32
.cpp:477:71: error: 'MonitorFromRect' was not declared in this scope
C:\Users\HM\Downloads\opencv-2.4.8\opencv\sources\modules\highgui\src\window_w32
.cpp: In function 'LRESULT MainWindowProc(HWND, UINT, WPARAM, LPARAM)':
C:\Users\HM\Downloads\opencv-2.4.8\opencv\sources\modules\highgui\src\window_w32
.cpp:1355:69: error: 'MonitorFromRect' was not declared in this scope
mingw32-make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w
32.cpp.obj] Error 1
mingw32-make[2]: Leaving directory `C:/Users/HM/Downloads/opencv-2.4.8/opencv/bu
ildMingW32'
mingw32-make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
mingw32-make[1]: Leaving directory `C:/Users/HM/Downloads/opencv-2.4.8/opencv/bu
ildMingW32'
mingw32-make: *** [all] Error 2
If I uncheck with WITH_WIN32UI
in CMake the library gets build, but anything using windows from highgui crashes at runtime. Any tips on I could move on ?