0

After doing CMake (all with default) I open the Code:Block project file and building gives these errors:

        D:\Guido\develop\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'void cvSetModeWindow_W32(const char*, double)':
        D:\Guido\develop\opencv\sources\modules\highgui\src\window_w32.cpp:474:47: error: 'MONITOR_DEFAULTTONEAREST' was not declared in this scope
                     hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
                                                       ^
        D:\Guido\develop\opencv\sources\modules\highgui\src\window_w32.cpp:474:71: error: 'MonitorFromRect' was not declared in this scope
                     hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
                                                                               ^
        D:\Guido\develop\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT MainWindowProc(HWND, UINT, WPARAM, LPARAM)':
        D:\Guido\develop\opencv\sources\modules\highgui\src\window_w32.cpp:1377:45: error: 'MONITOR_DEFAULTTONEAREST' was not declared in this scope
                   hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
                                                     ^
        D:\Guido\develop\opencv\sources\modules\highgui\src\window_w32.cpp:1377:69: error: 'MonitorFromRect' was not declared in this scope
                   hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);

... what makes all this more strange:

At the beginning of this file (window_w32.cpp) the symbol _WIN32_IE is not defined at all (why?).

As I'm new to C:B and OpenCV hints are appreciated.

Edit: I just found a hint by myself:

http://answers.opencv.org/question/104125/i-am-unable-to-build-opencv-using-mingw-codeblockstotally-a-beginner/

Do I understand this right, that mingw 4.9.2 does not do with recent openCV? (But 4.9.2 is the compiler that is actually shipped with C:B) ...

User42
  • 83
  • 10

1 Answers1

0

Figured it out.

Despite OpenCV dropped mingw compiler support in 2015 (why that??) it is well possible to build OpenCV with mingw.

2 modules make problems when building: highgui and ts.

Both seems to have to do with the way mingw handles windows headers.

For module highgui: Error while building OpenCV :: MonitorFromRect was not declared in this scope

For module ts: https://github.com/google/googletest/issues/893

Why - in heaven's name - so much stumbling stones on a way to use a freeware toolchain? No wonder that M$ will smother everything. It has to be convenient to use. If I need a car to do my work, I want to use the car. Not have to build ("and to understand, that's important!") it. SCNR.

User42
  • 83
  • 10