<div dir="ltr"><div>Hi all,<br></div><div><br></div><div>I started to use precompiled headers with Clang the other day, and I was a little confused with the documentation at <a href="http://clang.llvm.org/docs/UsersManual.html#generating-a-pch-file">http://clang.llvm.org/docs/UsersManual.html#generating-a-pch-file</a></div>
<div><br></div><div>To make a long story short, I found the combination of generating a PCH file and then using "-include my_pch_header.h" to get clang to use it pretty hard to get right. I messed it up a few times, including putting the PCH in the wrong directory, and accidentally generating a bad PCH file, but I didn't get any helpful messages pointing me toward what was wrong.</div>
<div><br></div><div>Eventually I found the flag "-include-pch", which when enabled immediately started to give my helpful errors and warnings, like the fact that clang couldn't find my PCH file, or that when it did it wasn't even a pch file, and I soon got everything working.</div>
<div><br></div><div>My suggestion is to replace the example "clang -include test.h test.c -o test" in the user manual with "clang -include-pch test.h.gch test.c -o test", since it seems less error prone.</div>
<div><br></div><div>Best regards,</div><div>Casey</div></div>