Modifying WINVER and _WIN32_WINNT

Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, or Windows NT. 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.


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

#define WINVER 0x0500
#define _WIN32_WINNT 0x0500

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


Values are not guaranteed to work if you include internal MFC headers in your application. For example, Windows 2000 is not supported in afximpl.h.

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

Previous Product Changes