I always hate gch file

A semester did not write a blog.
Today, OOP write operations hell, tune for a long time.

I wrote a match.h and a match.cpp, then match.cpp inside #include "match.h", then g ++ match.cpp -o match.o -c always wrong

Finally, I found a copy of the match.h and match.cpp to f K. H., f k.cpp, f ** k.cpp can be compiled

Then in the working directory found a match.h.gch

Then this match.h.gch deleted just fine

match.h.gch is compiled header files match.h intermediate results, in order to speed up the compiler, when compiling match.o will directly match.h.gch engage in, not to look match.h

The problem is that if you modify the match.h, but did not update the corresponding match.h.gch, will lead match.h version with compile-time and not the same as you think. You think compiler uses is that you have just finished saving changes match.h to version, but the compiler directly before the match.h.gch, equivalent to using an older version of the compiler generated when match.h file gch

Then I ignorant force for a long time.

So why would a match.h.gch out? Because I hit compile command when accidentally hit a blind g++ match.h, this time by default g ++ directly generate the corresponding gch file (I do not know)

So I will not fight again blind to compile commands.

Guess you like

Origin www.cnblogs.com/liu-runda/p/10981411.html