WINDOWS.H already included error
I made sure that the windows.h was not included in any of the project files I have. I am using a visual studio 2008 IDE
Any reason why ?
reason why is because something is including Windows.h: the compiler is not lying to you.
Go to project Properties->Configuration Properties->C/C++->Advanced and set Show Includes to Yes. Then build, and the compiler will show you a list with every included file found, and in the order it finds it, hereby telling you which file eventually includes windows.h
try and include afxcoll.h before stdafx.h. I had the same problem and it fixed it. See http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/2ab6862f-0d90-467a-b283-f62f6aef96fe/ for the original discussion.
#include "afxwin.h" // MFC core and standard components
#include "afxext.h" // MFC extensions
Adding these to my stdafx.h file sorted out that error..hope this helps someone else.
Visual Studio by default will defile your program with a precompiled headers file, which may contain something which includes something which includes windows.h . Be sure to check in there.
In your project go to Configuration Properties->C/C++ -> Precompiled Headers. Make sure the Precompiled Header setting is set to Use(/Yu).
This setting "Enables creation or use of a precompiled header during the build".
The problem I had was the "stdafx.h" file is being included in the "StdAfx.h" file, and the file name in Configuration Properties->C/C++ ->Precompiled Headers was never updated from "stdafx.h" to "StdAfx.h".
精彩评论