views:

106

answers:

6
+1  Q: 

Windows.h error

I am getting error :

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

Help needed.

+2  A: 

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.

unwind
+1  A: 

Oh well, the error message seems say just everything.

When you've created an MFC app, it already included windows.h.

GDR
+2  A: 

Using the /showIncludes preprocessor directive, the output window will display all the includes before the error. There you can find which file erroneously includes windows.h.

Then find out why this file is needed.

xtofl
A: 

Sometimes, the best way to fix errors is to do as the error message says.

Just a thought.

jalf
+1  A: 

I believe this is an error on Microsoft's part. After all, the guards on the include file should protect against this issue. A big -10 to Microsoft.

Thomas Matthews
+2  A: 

If you use MFC, do not use #include <windows.h> manually anywhere in your code. MFC includes it in its own way and you already have access do all declarations of this header.

AOI Karasu