Click here to Skip to main content
13,140,742 members (47,463 online)
Rate this:
Please Sign up or sign in to 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,


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

Posted 10-Oct-12 22:19pm
Updated 12-Oct-12 1:59am
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
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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).
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Do not #include <windows.h> in MFC applications.
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 12 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100