Modifying WINVER and _WIN32_WINNT

Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, Windows NT or Windows 2000. If your WINVER or _WIN32_WINNT macros are assigned to one of these versions of Windows, you must modify the macros. When you upgrade a project that was created by using an earlier version of Visual C++, you may see compilation errors related to the WINVER or _WIN32_WINNT macros if they are assigned to a version of Windows that is no longer supported.

Remarks

To modify the macros, in a header file, add the following lines.

#define WINVER 0x0602
#define _WIN32_WINNT 0x0602

This targets the Windows 8 operating system. Other valid values include 0x0501 for Windows XP, 0x0502 for Windows Server 2003, 0x0600 for Windows Vista, 0x0601 for Windows 7, 0x602 for Windows 8 and 0x603 for Windows 8.1.

Note

Values are not guaranteed to work if you include internal MFC headers in your application.

You can also define this macro by using the /D compiler option. For more information, see /D (Preprocessor Definitions).

For more information about the meanings of these macros, see Using the Windows Headers.

See Also

Other Resources

Upgrading Programs