GCC & precompiled headers question

Matt McCutchen matt at mattmccutchen.net
Sun May 9 21:30:26 UTC 2010

On Sun, 2010-05-09 at 04:25 +0200, Kevin Kofler wrote:
> Christoph Höger wrote:
> > Unfortunately g++ also allows one single precompiled header per
> > compilation unit. Does anyone know why?
> Because a g++ "precompiled header" is more or less a dump of the complete 
> compiler state, which is loaded and from which compilation continues. 
> Obviously this can only work for a single header included before any non-
> comment non-whitespace line.

That's not quite right.  There can be macro definitions as long as none
of the macros are tested in #if/#ifdef directives that went into the
precompiled header.  There are some more details in the info docs.


More information about the devel mailing list