On Fri, Jan 13, 2006 at 10:47:43AM +0100, Rolf Kalbermatter wrote:
>  
> > On Thu, Jan 12, 2006 at 09:02:42PM +0100, Rolf Kalbermatter wrote:
> > > Thomas Weidenmueller wrote:
> > > 
> > > > We've been using PCH with GCC for a long time in ReactOS, 
> > it's been
> > > > working very well and reliable. Compiling ReactOS is *a lot* 
> > > > faster with
> > > > PCH enabled.
> > > 
> > > Basically what I get in MSVC 6 when modifing a header somewhere and
> > > PCH is enabled is that MSVC keeps mocking about errors in the
> > > headers, my change was supposed to fix. Disabling PCH (and
> > > sometimes deleting the *.pch file) always fixes those issues.
> > 
> > Unless, of course, your filesystem is samba-mounted from a linux box,
> > when PCH tends to cause internal compiler errors.
> 
> Well, I finally read a bit about how precompiled headers are supposed to work 
> and it seems MSVC does work in a similar way than gcc.
> Basically you can only have one pch file per working unit.
> 
> My problem was that when you create a new project in MSVC 6, PCH is by 
> default enabled and set to automatic but no specific header
> file is filled in in the project settings. What this seems to do is taking 
> some (which?) header files and putting them in an
> automatically generated pch file in your project output directory. Of course 
> for more than 1 source file in a project this is likely
> each time different so build times will be even worse than without PCH. Also 
> it seems that header dependancy tracking isn't reliable
> in such a setup.
> 
> >From some explanations, I gathered that the only useful PCH setting in MSVC 
> >is as well to use one specific pch include file and even
> more specifically configure one source file to create that pch file and all 
> others only to use it, otherwise MSVC tends to recompile
> the pch file on some arbitrary conditions multiple times for different source 
> files, basically reverting the purpose of PCH more or
> less or even make it worse.
> 
> One thing to watch out also is that any statements in a source file before 
> the specifically set precompiled header file are
> completely, and without any indication (well except the strange resulting 
> compile errors of course) ignored.


Hmm, perhaps use a CFLAGS "-include autogenerated.h" trick.

Generate "autogenerated.h" by collecting all possible includes via 
a script on "make depend", then force it into every file with
-include autogenerated.h (previously compiled to pch).

Has the advantage that the magic is all in the buildsystem, no
source files need to be touched.

Ciao, Marcus


Reply via email to