I was trying to build `OpenCV` `version 2.4.8` to use it with `CodeBlocks` and `MinGw`. I followed the instructions from [here](http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/). But I got the following error. I have no clue how to solve it. I didn't find anything useful by searching in the net.

[This](https://stackoverflow.com/questions/20709016/why-is-monitorfromwindow-missing-not-declared-c-winapi) is also not solving.

I don't want to mess with the `openCV` code, I intend to use `OpenCV` in my project and this is first time I am using it.

```
[ 26%] Built target pch_Generate_opencv_highgui
[ 26%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj
C:\Program Files (x86)\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'void cvSetModeWindow_W32(const char*, double)':
C:\Program Files (x86)\opencv\sources\modules\highgui\src\window_w32.cpp:477: error: 'MonitorFromRect' was not declared in this scope
C:\Program Files (x86)\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT MainWindowProc(HWND__*, UINT, WPARAM, LPARAM)':
C:\Program Files (x86)\opencv\sources\modules\highgui\src\window_w32.cpp:1355: error: 'MonitorFromRect' was not declared in this scope
mingw32-make.exe[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj] Error 1
mingw32-make.exe[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2 

```

I tried to manually include the prototype of the function in the file, but then it comes to linking error.  

will anyone please tell me what may have gone wrong here? How can I solve it?