How to fix PCH error?
When I try to build my app in Xcode
, I get this error message:
PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))
It doesn't happen before, but this was the first build after updating Xcode.
Other apps work, but not this specific one.
If I turn off the "Precompile Prefix Header"
setting, it works.
How do I fix this error and still keep that setting on?
This is often a caching problem. Usually it can be resolved by holding down the Option key and choosing Product > Clean Build Folder...
Delete the DerivedData
folder for the project. Look under Xcode preferences -> Locations to see where you save it.
It seems that the Product > Clean Build Folder... (with Option key pressed) works for most people. See the selected answer by @gaige.
If you're unlike most people (myself included) and this still causes you trouble XCode has likely left your shared precompiled headers elsewhere. For me they were in a folder similar to this:
/var/folders/<some random two characters>/<some random string>/C/com.apple.Xcode.502/SharedPrecompiledHeaders
I just deleted the entire SharedPrecompiledHeaders folder and that solved things for me. I wouldn't go touching much else in here though...