一个C++工程拷贝至另一个系统之后,重新编译,报如下错误: Error 1 error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended
原来是_WIN32_WINNT这个宏对应的版本好太低,导致无法编译通过。
解决办法:
stdafx.h文件打开
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
修改为:
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0502 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
保存后编译通过!