MinGW screw up with COLORREF and RGB

Posted by kjoppy on Stack Overflow See other posts from Stack Overflow or by kjoppy
Published on 2013-06-27T07:19:14Z Indexed on 2013/06/27 16:21 UTC
Read the original article Hit count: 205

Filed under:
|
|

I am trying to build a 3rd party open source project using MinGW. One of the dependencies is wxWidgets. When I try to make the project from MSYS I get a compiler error from

/MinGW/msys/1.0/local/include/wx-2.8/wx/msw/private.h

In function 'COLORREF wxColourToRGB(const wxColour&)':
error: cannot convert 'RGB' to 'COLORREF {aka long unsigned in}' in return

This is somewhat odd given that, according to Microsoft the RGB macro returns a COLORREF.

In fact, looking in H:\MinGW\include I find wingdi.h with the following code

#define RGB(r,g,b) ((COLORREF)((BYTE)(r)|((BYTE)(g) << 8)|((BYTE)(b) << 16)))

What sort of thing would cause this error? Is there some way I can check to see if COLORREF and RGB are being included from wingdi.h and not somewhere else? Is that even worth checking?

Specifications

  • GCC version 4.7.2
  • wxWidgets version 2.8.12

(I'm new to C++ and MinGW specifically but generally computer and programming literate)

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows