错误 C1189: #error:此文件需要至少 #defined_WIN32_WINNT才能0x0500.建议使用0x
error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0500. Value 0x0501 or higher is recommended
我在VS2010(windows xp)中创建MFC项目。我接受这个错误:
error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0500. Value 0x0501 or higher is recommended.
如果我在afxcomctl32.h
:#define _WIN32_WINNT 0x0501
中添加,我接受60+错误。在项目中,我没有添加任何内容。使用诸如创建Visual Studio之类的用途。我需要用这个做什么?
我认为afxcomctl32.h是一个错误的地方,要解决此问题,请使您的stdafx.h看起来像这样:
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0501 // 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 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0500 // Change this to the appropriate value to target IE 5.0 or later.
#endif
尝试将其添加到 StdAfx.h 文件的顶部:
#include <sdkddkver.h>
在我的应用程序中,我正在定义
_WIN32_WINNT=_WIN32_WINNT_WINXP
起初我遇到了同样的问题。 我发现这是因为当您使用 MFC 时,您不允许包含 windows.h,_WIN32_WINNT_WINXP从未定义过,因此_WIN32_WINNT没有有效的值。 通过包含 windows.h 用于定义这些值的标头 (sdkddkver.h),突然间一切正常!
嘭。 我讨厌为Windows编程。
您不需要修改 afxcomctl32.h。您只需要在此文件之前包含Windows.h。
应该工作。
我解决了我的问题。事实是,文件atmcore.h
与VS2010中的标准不同。
相关文章:
- Win32编译器选项和内存分配
- 当在带有Eigen的C++中使用GDB时,我如何才能看到更多的大矩阵
- 有没有可能有一个只有ADL才能找到的非好友功能
- 不确定要在我的main中放入什么才能使我的代码正常工作
- C++win32 API创建多个类似视口的窗口
- WM_CTLCOLORSTATIC从未在WIN32应用程序中触发
- 我提出什么条件才能再加5%的折扣
- 检测win32服务创建和删除的最佳方法
- WIN32:C++,为什么在WM_CLOSE上调用Messagebox函数程序正在冻结
- 为什么C++的文件 I/O 在读取文本文件时忽略初始空行?我怎样才能让它不这样做?
- 我怎样才能将所有子目录与 cmake 自动匹配
- 将 win32 hbitmap 转换为 winrt softwarebitmap
- 使用 WIN32 API (C/C++) 对特定树视图项进行着色
- Alt+Enter 在 Win32 应用中,管理大小调整和分辨率
- VSCode C++ 编译的exe感染了Win32:TrojanX-gen[Trj]
- 从预处理器获取 Windows 版本(C++ Win32)
- Issues with Win32 ReadProcessMemory API
- Win32 发送输入鼠标移动滞后并冻结
- 为什么我必须添加一个小数才能在C++中正确计算此数学
- 如何从 Win32 C++ 应用程序输出到父控制台窗口?