简体   繁体   English

Windows.h错误

[英]Windows.h error

I am getting error : 我收到错误:

WINDOWS.H already included.  MFC apps must not #include <windows.h>

Help needed. 需要帮助。

Remove the second inclusion, from (presumably) your code. 从(大概)你的代码中删除第二个包含。 Here is a MSDN forum thread about the problem, it seems it can also depend on your exact inclusion order. 是一个关于这个问题的MSDN论坛帖子,它似乎也取决于你的确切包含顺序。

Using the /showIncludes preprocessor directive, the output window will display all the includes before the error. 使用/showIncludes预处理程序指令,输出窗口将显示错误之前的所有包含。 There you can find which file erroneously includes windows.h . 在那里你可以找到错误地包含windows.h文件。

Then find out why this file is needed. 然后找出为什么需要这个文件。

If you use MFC, do not use #include <windows.h> manually anywhere in your code. 如果使用MFC,请不要在代码中的任何位置手动使用#include <windows.h> MFC includes it in its own way and you already have access do all declarations of this header. MFC以自己的方式包含它,您已经有权访问此标头的所有声明。

Oh well, the error message seems say just everything. 哦,错误消息似乎只是说一切。

When you've created an MFC app, it already included windows.h. 当您创建了一个MFC应用程序时,它已经包含了windows.h。

Sometimes, the best way to fix errors is to do as the error message says . 有时,修复错误的最佳方法是按错误消息说明

Just a thought. 只是一个想法。

使用mfc时,请使用#include <afx.h>而不是#include <windows>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM