Re: reduce compilation times?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 5, 2007 1:44 AM, mahmoodn <nt_mahmood@xxxxxxxxx> wrote:
>
> For example look at this paragraph in that link:
>
> >To create a precompiled header file, simply compile it as you would any
> other file, if necessary using the -x option to make >the driver treat it as
> a C or C++ header file. You will probably want to use a tool like make to
> keep the precompiled header >up-to-date when the headers it contains change.
>
> I can not understand it. My little understanding is, I just use normal
> "make" for the first time. Then the compiler would create some precompiled
> headers. After doing this, I could not find ant gch file for precompiled
> header.

No, it won't do it automaticalyy.  You have to modify your Makefile a
little.  Say we have foo.cc and its header, foo.h, then something like
this in the Makefile should work:

CXX = g++

foo.o : foo.cc foo.h.gch
<tab>$(CXX) -c $<

foo.h.gch: foo.h
<tab>$(CXX) -c $<

-Tom

Tom Browder
Niceville, Florida
USA

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux