简体   繁体   中英

MinGW screw up with COLORREF and RGB

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 int}' 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)

Try preprocessing the source with -E and check what is actually happening with the macro expansion or whether something is redefining the macro.

The preprocessed source undoubtedly will be very lengthy after #include ing its header dependencies. Your text editor's search function, grep and findstr are your friends here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM