简体   繁体   中英

NTDDI_VERSION setting conflicts with _WIN32_WINNT setting

With VS2010 I have this error:

error C1189: #error :  NTDDI_VERSION setting conflicts with _WIN32_WINNT setting

in StdAfx.h is use:

#define _WIN32_WINNT 0x0502 

and in my other source my.cpp i use:

#define NTDDI_VERSION 0x06000000 

How I can solve that?

#define NTDDI_VERSION 0x06000000 

That is Vista.

#define _WIN32_WINNT 0x0502 

That is Server 2003.

And so these versions are indeed conflicting. If you want to support Vista and up you'll need:

#define NTDDI_VERSION 0x06000000 
#define _WIN32_WINNT 0x0600 

If you want Server 2003 and up then you use:

#define NTDDI_VERSION 0x05020000
#define _WIN32_WINNT 0x0502 

Note that the NTDDI_VERSION define can also specify service packs. So if you want Vista SP1 and up then you use:

#define NTDDI_VERSION 0x06000100 
#define _WIN32_WINNT 0x0600 

As a general rule you want to set these defines to the value corresponding to the minimum version that you wish to support.

Rather than using these magic constants, you should write, for example:

#define NTDDI_VERSION NTDDI_VISTA 
#define _WIN32_WINNT _WIN32_WINNT_VISTA 

For more details refer to MSDN: Using the Windows Headers .

NTDDI_VERSION 0x06000000 is Windows Vista, so you need #define _WIN32_WINNT 0x0600 .

MSDN has the details you need right 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