错误 C1189:#error:窗口。H 已包括在内。MFC 应用不得 #include < Windows.h>"**
error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>"**
我有一个使用stdafx.h作为预编译头的项目。这意味着所有的cpp文件必须包含#include "stdafx.h"作为第一个include。
然而,在A.h中,我需要包含"afxinet.h",但是编译器抱怨这个
"错误C1189: #error: WINDOWS.H已包含。MFC应用不能#include "windows.h"
"这是因为"afxinet.h"在包含WINDOWS.H时报错,但"stdafx.h"确实包含了WINDOWS.H,并且作为A.cpp中的第一个包含。
这意味着我需要在"stdafx.h"前面包含"afxinet.h",但"stdafx.h"是预编译头文件,需要作为第一个包含…
我该如何解决这个困境?
如果你的项目使用MFC,那么你应该在stdafx.h中包含它的头文件,而不是使用windows.h(因为它将被MFC包含);如果包含windows.h,则不能使用MFC。afxinet.h是MFC的一部分,所以,我猜,你应该(1)用afxwin.h替换你的windows.h和"使用MFC"设置(2)不使用MFC包装WinInet,使用WinInet .h的函数
相关文章:
- 既然存在危险,为什么项目要使用-I include开关
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- 有充分的理由在h文件中使用include保护而不是cpp文件吗
- 呼叫运营商<<临时
- 如何将更多文件夹添加到c++include路径
- 什么是"#include <boost/functional/hash.hpp> "?
- 如何防止clang格式在流运算符调用之间添加换行符<<
- <<操作员在下面的行中工作
- 对于MacOS上的G++,如何添加默认的include目录/usr/local/include和默认的库搜索路径/usr
- C++包含来自 #include "DevEngine/Core.h" 的错误
- <filesystem> 在 clang 6 和 10 上 #include 错误
- 在 void 函数中使用 #include 变量C++
- N-API include an .so or dll
- 允许哪些令牌作为 #include 的参数?
- GCC 包含标头(使用"-include")CMake 未检测到的更改
- WebAssembly include OpenCV
- 如何在 c++ 中正确指定 #include 路径以使程序可移植
- 修改生成文件以简化框架 #include 路径
- VS2015/VC++ 在新类模板中禁用默认 #include "stdafx.h"
- opencv 2.4.7在iOS错误背景_segm.hpp #include&lt; list&gt;未找到