PCH is used only for the first header

Geoff Keating geoffk@geoffk.org
Mon Jun 2 17:05:00 GMT 2003


"Briltz, Denis" <Denis.Briltz@intel.com> writes:

> >> >"A precompiled header file can be used only when these conditions apply:
> >> >[...] Only one precompiled header can be used in a particular
> >> > compilation."
> >> Does "only one" means "only first one"? What if I want only "b.h.gch" to
> be
> >> used?
> 
> >I think the supposed solution is that you create a new file "all.h" that 
> >contains
> >      #include "a.h"
> >      #include "b.h"
> 
> >and then include all.h.
> 
> Thanks, I am aware about this solution.
> 
> My point was that gcc uses pch only for the _first_ included header and this
> is not documented.

This is a simplification of the actual rules.  The documentation
completely describes what actually happens.  For instance, if 'a.h' is
completely empty, and there is no PCH for it, a PCH for 'b.h' can be used.

-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc mailing list