fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

简介:  在Windows下使用mysql API或者WinSock API的时候,需要包含#include <WinSock2.h>。   编译的时候就会遇到标题所示的问题。   一般最简单的坚决办法是:在包含WinSock2.h之前包含其它的。   可以双击这条报错语句,然后看看是哪个头文件报错了,一般情况下是,就在WinSock2.h之前包含它。   我这边的W
 在Windows下使用mysql API或者WinSock API的时候,需要包含 #include <WinSock2.h>。
  编译的时候就会遇到标题所示的问题。

  一般最简单的坚决办法是:在包含WinSock2.h之前包含其它的。
  可以双击这条报错语句,然后看看是哪个头文件报错了,一般情况下是,就在WinSock2.h之前包含它。

  我这边的WinSock2.h是这么使用的:

  #include <afxwin.h>
  #include <WinSock2.h>

  如果不愿深究,可以这么尝试,一般都能解决问题。
目录
打赏
0
0
0
0
5
分享
相关文章
Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx
Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx
208 0
|
11月前
|
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
170 1
解决方案-CMake error: error in configuration process, project files may be invalid(Windows&VS可参考)
解决方案-CMake error: error in configuration process, project files may be invalid(Windows&VS可参考)
3927 0
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
Docker在win10上报错,error during connect: In the default daemon configuration on Windows
Docker在win10上报错,error during connect: In the default daemon configuration on Windows
525 0
逆向学习 MFC 篇:视图分割和在 C++ 的 Windows 窗口程序中添加图标的方法
逆向学习 MFC 篇:视图分割和在 C++ 的 Windows 窗口程序中添加图标的方法
185 0
Windows Docker Desktop 无法启动 自动退出报错信息为:Docker Desktop -Unexpected WsL error An unexpected error was e
Windows Docker Desktop 无法启动 自动退出报错信息为:Docker Desktop -Unexpected WsL error An unexpected error was e
796 0

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等

登录插画

登录以查看您的控制台资源

管理云资源
状态一览
快捷访问