How to: Modify WINVER and _WIN32_WINNT

Beginning with Visual C++ 2008, Visual C++ does not support 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 will need to modify the macros. When you upgrade a project that was created from a previous 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 will target the Windows 2000 operating system. Other valid values include 0x0501 for Windows XP, 0x0502 for Windows Server 2003, and 0x0600 for Windows Vista.

You can also define this macro with the /D compiler option; see /D (Preprocessor Definitions) for more information.

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

See Also

Other Resources

Previous Product Changes