How to use VC_EXTRALEAN and WIN32_LEAN_AND_MEAN to enhance the build process in Visual C++

Article translations Article translations
Article ID: 166474 - View products that this article applies to.
This article was previously published under Q166474
Expand all | Collapse all

SUMMARY

To speed the build process, Visual C++ and the Windows Headers provide the following new defines:
   VC_EXTRALEAN
   WIN32_LEAN_AND_MEAN
				
You can use them to reduce the size of the Win32 header files.

MORE INFORMATION

VC_EXTRALEAN and WIN32_LEAN_AND_MEAN are used to exclude rarely-used services from Windows headers. VC_EXTRALEAN can only be used in MFC projects, but WIN32_LEAN_AND_MEAN can be used in any project.

VC_EXTRALEAN defines the following in AFXV_W32.h:
   WIN32_EXTRA_LEAN
   NOSERVICE
   NOMCX
   NOIME
   NOSOUND
   NOCOMM
   NOKANJI
   NORPC
   NOPROXYSTUB
   NOIMAGE
   NOTAPE
				
WIN32_EXTRA_LEAN does not do anything. Please refer to Windows.h for information concerning the NOxxx symbols that are being defined.

Newly-generated Visual C++ 5.0 and later AppWizard applications automatically benefit from VC_EXTRALEAN. You can also manually define VC_EXTRALEAN to speed the build process of many older MFC applications.

WIN32_LEAN_AND_MEAN: Windows Headers use this symbol to exclude rarely-used header files. Please refer to Windows.H to determine the files that will be excluded when this symbol is defined. Since MFC defines WIN32_LEAN_AND_MEAN, all MFC projects automatically use it.

Non-MFC C++ and C applications can define WIN32_LEAN_AND_MEAN and any applicable NOservice defines, such as NOSOUND (see DevStudio\Vc\include\Windows.h), to reduce their build times.

To add these defines, from the Project menu, choose Settings. The Projects settings dialog box appears. Click the C/C++ tab. In the Category list, select Preprocessor. Add the desired definitions to the Preprocessor Definitions box.

Properties

Article ID: 166474 - Last Review: September 1, 2005 - Revision: 3.0
APPLIES TO
  • Microsoft Visual C++ 4.0 Standard Edition
  • Microsoft Visual C++ 4.1 Subscription
  • Microsoft Visual C++ 4.2 Enterprise Edition
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 4.2 Professional Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kbhowto kbinfo kbperformance KB166474

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