This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: reduce compilation times?
On Dec 5, 2007 1:44 AM, mahmoodn <nt_mahmood@yahoo.com> 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