[Interest] Pollution of compilation unit by Windows headers via qt_windows.h include

Roger Leigh rleigh at codelibre.net
Wed May 4 19:43:13 CEST 2016


Hi folks,

I'm including various headers, e.g. QtOpenGL and QtWidgets headers, 
which include <QtCore/qt_windows.h>, which then includes either directly 
or indirectly, headers such as <um/winnt.h> and <um/wingdi.h>, which 
define macros such as VOID and HALFTONE.  I think <QtCore/qopengl.h> is 
the culprit in this case, and it doesn't look like that's particularly 
avoidable.

I'm using a TIFF library which defines enum values including VOID and 
HALFTONE (which are TIFF tags).  This breaks compilation since the enums 
are replaced with "void" and "4" respectively for VOID and HALFTONE. 
This is obviously working just fine on every other platform, it's just 
Windows at fault.

I'd basically like to ask if anyone else has encountered issues like 
this, and if so:

- is there any way of avoiding or hiding the includes?
- any other known workarounds or suggestions?

I'd rather not undef things since my headers might be used by others and 
they might need the defines.


Thanks,
Roger



More information about the Interest mailing list