Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 240
user2997361 Avatar asked Jan 09 '14 20:01

user2997361


2 Answers

#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.

like image 119
David Heffernan Avatar answered Oct 22 '22 11:10

David Heffernan


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

MSDN has the details you need right here.

like image 23
Roger Rowland Avatar answered Oct 22 '22 10:10

Roger Rowland