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

Article translations Article translations
Article ID: 922323 - View products that this article applies to.
Expand all | Collapse all

On This Page

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.

Properties

Article ID: 922323 - Last Review: August 10, 2006 - Revision: 1.0
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
Keywords: 
kbtshoot kbbug kbcode KB922323

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com