[cfe-dev] Compiling clang on Windows/TDM-GCC 4.8.1-3 (MinGW32)

Aaron Ballman aaron at aaronballman.com
Thu Sep 11 11:07:46 PDT 2014


On Thu, Sep 11, 2014 at 1:51 PM, Reid Kleckner <rnk at google.com> wrote:
> On Thu, Sep 11, 2014 at 10:32 AM, Rafael EspĂ­ndola
> <rafael.espindola at gmail.com> wrote:
>>
>> On 11 September 2014 13:29, Eran Ifrah <eran.ifrah at gmail.com> wrote:
>> > The header file is included indirectly (<winnt.h>). However, the
>> > definitions
>> > are not visible since _WIN32_WINNT is set to a value lower than 0x0502
>> > Attached is a patch to the CMakeLists.txt file that adds
>> > -D_WIN32_WINNT=0x0502 in case of MinGW and WIN32 conditions are met
>>
>> Not sure which one is better. Aaron, any thoughts?
>
>
> Given that there are approximately *two* places where we include windows.h /
> winnt.h, I think we should define the macro in the .cpp file rather than
> adding a flag for every TU. It appears we don't define WINVER & co anywhere
> else, so let's not change that practice.

We already have this macro in WindowsSupport.h which is included all
the places this would matter. I would rather we not spread
_WIN32_WINNT definitions in multiple places. Also, it was my
understanding that when you define that, you really should define
WINVER as well for Win32 API declaration consistency. It may not be
strictly required, but it is suggested by MSDN.

> I also don't think this needs to be MinGW specific. It's just that the Win7
> / Win8 SDKs we use don't support pre-XP OSs with the #ifndef directives that
> MinGW appears to use.

Agreed that this does not need to be MinGW-specific.

~Aaron




More information about the cfe-dev mailing list