欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > windows >内容正文

windows

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

发布时间:2025/3/13 windows 59 豆豆
生活随笔 收集整理的这篇文章主要介绍了 error C1189: #error : WINDOWS.H already included. MFC apps must not #include windows.h 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

http://ghyan1208.blog.163.com/blog/static/162866676201072511746382/

错误原因主要是因为#include <afx.h>这句的位置不对,应该放在第一行。在每一个.cpp或.h里面都应该是第一行。 : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> 我是在windows console下编译  枚举局域网主机名及其ip   的时候遇到这个问题的 #include "winsock2.h " #include <afx.h>//因为要用到CString所以要包含这个头文件
#include <iostream>
using namespace std; 后来把头文件包含位置换了下  编译通过 #include <afx.h>//因为要用到CString所以要包含这个头文件 #include "winsock2.h "
#include <iostream>
using namespace std;

转载于:https://www.cnblogs.com/justiner/archive/2011/12/14/2287205.html

总结

以上是生活随笔为你收集整理的error C1189: #error : WINDOWS.H already included. MFC apps must not #include windows.h的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。