Search code examples
visual-c++visual-c++-2022

What value should WINVER be for Windows 10?


In my stdafx.h file I have:

#ifndef WINVER              // Allow use of features specific to Windows 2000 or later.
#define WINVER 0x0501       // Change this to the appropriate value to target other versions of Windows.
#endif

How do I find out what the value should be for Windows 10? I want this to be the minimum supported platform for my MFC project now.


Solution

  • If you want to build using APIs that are available in Windows 10 or later, then you'd use:

    #include <winsdkver.h>
    #ifndef _WIN32_WINNT
    #define _WIN32_WINNT 0x0A00
    #endif
    #include <sdkddkver.h>
    

    See Microsoft Docs.

    Per the comment, you probably also want to set the linker minimum supported OS to 10.0.