I started to use precompiled headers with Clang the other day, and I was a little confused with the documentation at http://clang.llvm.org/docs/UsersManual.html#generating-a-pch-file
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.
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.
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.