Microsoft KB Archive/922323

= BUG: You receive many compilation error messages when you compile a Visual C++ application in Visual Studio 2005 =

Article ID: 922323

Article Last Modified on 8/10/2006

-

APPLIES TO


 * Microsoft Visual Studio 2005 Team System Architect Edition
 * Microsoft Visual Studio 2005 Team System Developer Edition
 * Microsoft Visual Studio 2005 Team System Test Edition
 * Microsoft Visual Studio 2005 Team Foundation
 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Express Edition

-





SYMPTOMS
Consider the following scenario:
 * You create a Microsoft Visual C++ application in Microsoft Visual Studio 2005.
 * You include the following header files:
 * Windows.h
 * Gdiplus.h

In this scenario, when you compile the application, you receive many compilation error messages.



CAUSE
This problem occurs because the default Stdafx.h file defines the WIN32_LEAN_AND_MEAN constant. When this constant is defined, necessary definitions for the Gdiplus.h file are excluded.



WORKAROUND
To work around this problem, comment out or delete the following line of code in the Stdafx.h file of the Visual C++ application project.
 * 1) define WIN32_LEAN_AND_MEAN       // Exclude rarely-used stuff from Windows headers



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the problem
 Start Visual Studio 2005. On the File menu, point to New, and then click Project. Under Project types, click Visual C++.

Note If you cannot see the Visual C++ project type, expand Other Languages, and then click Visual C++. Under Templates, click Win32 Console Application. Type a project name, and then click OK.</li> Click Finish.</li>  Paste the following code in the code window. Note Paste this code after the #include &quot;stdafx.h&quot; statement and before the int _tmain(int argc, _TCHAR* argv[]) statement. </li> On the Build menu, click Build Solution. You receive the compilation error messages that are mentioned in the &quot;Symptoms&quot; section.</li></ol>
 * 1) include <windows.h>
 * 2) include <gdiplus.h>

Keywords: kbtshoot kbbug kbcode KB922323

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.