I’m mainly refering to application-level imports, not when you build a library, in which case is obvious why you should avoid importing the headers inside the .pch file.
I’m mainly refering to application-level imports, not when you build a library, in which
Share
The point of the
.pchfile is that it can be precompiled once and left alone.If you import all of your application headers in the
.pch, it has to be recompiled every time you change any one of those headers, negating all of the benefits. Worse yet, this ends up meaning that every other file in your project has to be rebuilt, because the contents of the.pchchanged.The only headers that should be pulled in by your
.pchare headers that’ll almost never change, like system headers.