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



The information in this article 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 System 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.
#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 "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. Start Visual Studio 2005.
  2. On the File menu, point to New, and then click Project.
  3. Under Project types, click Visual C++.

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

Modification Type:MajorLast Reviewed:8/10/2006
Keywords:kbcode kbtshoot kbbug KB922323 kbAudDeveloper