Compiling on MacOSX is too long

Eljay Love-Jensen eljay@adobe.com
Thu Sep 2 11:48:00 GMT 2004


Hi,

 >The builds are too long.

Some builds take a long time.

There are several techniques you can employ to reduce build times.

+) In your header files, try to use forward references where possible, 
instead of including the header files.

+) To improve on #1, make "header-header" files.  These files contain the 
forward references, and maybe a smattering of other public facilities (such 
as enums).  Use the header-headers in your header files.  The header that 
that the header-header represents should be the first thing included by the 
actual header file.

+) Put guards in all your header files.

+) Include all the headers (or header-headers) that your header or source 
file requires.  Do not include anything beyond that!

+) Do not make "kitchen sink header files", which include everything.

+) Used the "pointer-to-implementation" technique (the "pimpl pattern"), to 
reduce rebuild time.

+) Follow Lako's suggestions, Large-Scale C++ Software Design 
<http://www.amazon.com/exec/obidos/tg/detail/-/0201633620>.

+) Follow Peter Miller's suggestions, Recursive Make Considered Harmful 
<http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html>.

HTH,
--Eljay



More information about the Gcc-help mailing list