BACKGROUND
As I understand it, in a C++ project:
- Project Properties => Configuration Properties => General => Platform Toolset
- Tells the compiler which SDK to physically compile against.
- For example: v140 will tell Visual Studio 2015 to use the latest and greatest v8.1 Windows SDK
_WIN32_WINNT
,WINVER
, andNTDDI_VERSION
macros- Depending on the underlying operating system, an SDK function can have a different function signature from OS-to-OS.
- SDKs are suppose to be backward compatible. 1
- The before mentioned macros enable you to specify which version of a function you wish to compile against.
MY QUESTION
If I compile my application with the following setup:
- project properties => configuration properties => General => Platform Toolset
- set to:
v140_xp
(Visual Studio 2015 - Windows XP) - Setting tells compiler to use the 7.1 SDK, which makes sense.
- set to:
- content of:
StdAfh.h
#include <WinSDKVer.h>
#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
#define NTDDI_VERSION 0x05010000
#include <SDKDDKVer.h>
- Macros tell compiler which function signatures to use, which makes sense.
From what I can tell, it looks like Target Platform Version is an suposed to be an alternative to the _WIN32_WINNT
, WINVER
, and NTDDI_VERSION
macros. The weird thing is, with the above configuration you can set the Target Platform Version to 1
or 99
... and the compiler doesn't generate any errors or warnings.
This this leaves me wondering: What is the Target Platform Version for?
ADDITIONAL CONTEXT
- Compiler: Visual Studio 2015
REFERENCES
- Windows SDK Brokenness
- Target Platform Version general project property on VS2015
- Using the Windows Headers
- What is WINVER?
- Modifying WINVER and _WIN32_WINNT
- Visual Studio setting WINVER/_WIN32_WINNT to Windows 8 on Windows 7?
EDIT HISTORY
- 2016/09/21: As per Hans' comment, macros have been updated to reference Windows XP.