Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
D:\new\VC98\MFC\INCLUDE\afxv_w32.h(14) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>



My English is not very good,So we can't do more description

The above is error information

please help me,

thanks!

I use vc + + 6.0

Create project (Win32 Appliction) -> a simple appliction

->Manually add dialog resources

but compile error

This is MFC application?

Please Tell Me! thanks!

I will upload the file,GIFIframe by IllusionWing

download file link:
download address 1
download address 2

sos...
Posted
Updated 12-Oct-12 1:59am
v5
Comments
Mohibur Rashid 11-Oct-12 4:46am    
First of all, your error message says that it is a MFC Application.

So as Richard MacCuthan said do not include windows.h

But the method you followed suggested that you are using plain win32. Open your project property and check whether MFC is in use or not

From the steps you depicted I suppose your application is NOT a MFC one. However it somehow includes the afxv_w32.h header file which is part of the MFC library.
You migh discard such a header file (unless you really need MFC).
 
Share this answer
 
Do not #include <windows.h> in MFC applications.
 
Share this answer
 
v2
Comments
Jochen Arndt 11-Oct-12 4:40am    
Richard, I edited your solution fixing the code tag (was only showing #include without the header file).
Richard MacCutchan 11-Oct-12 17:17pm    
Thanks, my bad.
Stefan_Lang 12-Oct-12 8:32am    
I ran into this problems with various versions of VisualStudio, but I never really understood why the VS precompiler can't deal with this, or why windows.h doesn't simply use the usual include guards or an equivalent technique. Why do they put the onus of avoiding a duplicate include on the users?

Also the VS header files in general do a really bad job at avoiding unnecessary dependencies, and if you need anything but the standard set of libraries that you get included by the project wizard, it's really easy to mess up the order of includes. Isn't there anyone at MS who knows how to clean up headers?

I once spent the better part of a weak to clean up the header-mess in a legacy project (about 3 million loc!). But as a result compile times were sped up by a factor of 5, and errors due to bad inclusion order vanished entirely. I'm sure, if someone at MS did something like that, it would be a huge improvement.
Richard MacCutchan 12-Oct-12 14:56pm    
True, but your rant is targeting the wrong people.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900