Jump to content
  • Advertisement
Sign in to follow this  


This topic is 4994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

is there any other defs. like WIN32_MEAN_AND_LEAN that can be used to reduce building time? How do i use the NO... (NOSOUND,NOMSG,NOHELP,etc) defs. in a correct way?

Share this post

Link to post
Share on other sites
There are also:


I'm not exactly sure what they remove from the headers though.


Share this post

Link to post
Share on other sites
These days, people don't really use those defs, at least when compiling under Visual Studio. Precompiled headers provide more of a speedup than LEAN_AND_MEAN ever could. If you aren't using them, start.

Share this post

Link to post
Share on other sites
Why not? If you can cut out garbage from the PCH, much the better. It isn't too much trouble, and a proxy header (that in turn includes windows.h) is useful anyway to set WINVER consistently, and work around missing or incorrect definitions (e.g. in dbghelp and powrprof).

Relevant parts of such a header:


#define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
//#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
//#define NOWINSTYLES // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
#define NOSYSMETRICS // SM_*
#define NOMENUS // MF_*
#define NOICONS // IDI_*
#define NOKEYSTATES // MK_*
//#define NOSYSCOMMANDS // SC_*
#define NORASTEROPS // Binary and Tertiary raster ops
//#define NOSHOWWINDOW // SW_*
#define OEMRESOURCE // OEM Resource values
#define NOATOM // Atom Manager routines
//#define NOCLIPBOARD // Clipboard routines
#define NOCOLOR // Screen colors
//#define NOCTLMGR // Control and Dialog routines
#define NODRAWTEXT // DrawText() and DT_*
//#define NOGDI // All GDI defines and routines
//#define NOKERNEL // All KERNEL defines and routines
//#define NOUSER // All USER defines and routines
#define NONLS // All NLS defines and routines
//#define NOMB // MB_* and MessageBox()
#define NOMEMMGR // GMEM_*, LMEM_*, GHND, LHND, associated routines
#define NOMINMAX // Macros min(a,b) and max(a,b)
//#define NOMSG // typedef MSG and associated routines
#define NOOPENFILE // OpenFile(), OemToAnsi, AnsiToOem, and OF_*
#define NOSCROLL // SB_* and scrolling routines
#define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
//#define NOSOUND // Sound driver routines
#define NOTEXTMETRIC // typedef TEXTMETRIC and associated routines
//#define NOWH // SetWindowsHook and WH_*
#define NOWINOFFSETS // GWL_*, GCL_*, associated routines
//#define NOCOMM // COMM driver routines
#define NOKANJI // Kanji support stuff.
#define NOHELP // Help engine interface.
#define NOPROFILER // Profiler interface.
#define NODEFERWINDOWPOS // DeferWindowPos routines
#define NOMCX // Modem Configuration Extensions

#include <windows.h>

Simply comment out a define if you end up needing what it removes.

Share this post

Link to post
Share on other sites
Thanx jan thats what what i needed to know. But, what about using precompiled headers, is this done by using the /YX switch in the project settings?

Share this post

Link to post
Share on other sites
Yes. It works like this:

- You create a special header file which includes all those large, seldomly changed headers like windows.h, d3d9.h, my_huge_library.h. The assistant from VisualC++ calls this precompiled header file stdafx.h

- The first non-blank, non-comment line of any source files (*.c, *.cpp) should be an include directive which includes the precompiled header file

- For the entire project, set /Yu to use the precompiled header file

These three steps can also be skipped and instead /YX be used to let the compile automatically include the precompiled header file - beware, however, that you project then won't compile anymore on compilers not having precompiled header support.

- Final step is to create a matching source file to include your precompiled header file and set, for this source file only, the precompiled header setting to "create precompiled header file".

The compiler will when compile this source file before any others and use it to create precompiled headers in a large file that can for all other files in a project be re-used, so all those large headers don't have to be parsed over and over.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!