解决方法:#error WINDOWS.H already included. MFC apps must not #include <windows.h>

问题

在使用VS调试程序时,时常会出现这个问题:#error WINDOWS.H already included. MFC apps must not #include <windows.h>,根本原因在于,对windows.h文件进行了重复引用。

解决方法

将windows.h本身或包含windows.h的头文件放在头文件序列的最后。参考链接:https://blog.csdn.net/ypist/article/details/8505666

此时,可能会出现如下问题:

此问题解决方案参考:https://blog.csdn.net/ReversalC/article/details/53534476

即,在“项目--》属性--》链接器--》输入--》忽略特定默认库”以及“项目--》属性--》链接器--》输入--》附加依赖项”中分别添加:

uafxcw.lib // release版本
Libcmt.lib

uafxcwd.lib // debug版本
Libcmtd.lib

以上。

原文地址:https://www.cnblogs.com/cvwyh/p/10890058.html