Xcode version 4.6.2 (4H1003) compiler error
Iphonexcode4.6Ios5Iphone Problem Overview
I just updated to Xcode version 4.6.2 (4H10003) and tried to run a previously working application project in the simulator and received the following error and the build failed.
> PCH file built from a different branch ((clang-425.0.27)) than the compiler ((clang-425.0.28))
What went wrong and how can it be fixed?
Iphone Solutions
Solution 1 - Iphone
Do a Clean of the project; hold Option so that you are cleaning out the whole build folder and intermediates. You might have to quit Xcode and throw away the whole contents of the DerivedData folder by hand in the Finder, as I describe here: https://stackoverflow.com/questions/5714372/how-to-empty-caches-and-clean-all-targets-xcode-4/6247073#6247073
Solution 2 - Iphone
Go to your project's Build Settings
, find a setting named Precompiled Headers Cache Path
, then delete that folder
Solution 3 - Iphone
Do a cleanup using command+shift+k
and run existing project again.
Solution 4 - Iphone
From XCode 4.6.2 Release Notes
>## Known Issues ## > >### Building ### > >When building a product previously built with Xcode 4.6.1 or earlier, the build fails with an error similar to this one: > >PCH file built from a different branch ((clang-425.0.27)) than the compiler ((clang-425.0.28)) > >To address this issue, choose Product > Clean before building your product. 13663167
Performing Product > Clean works
Solution 5 - Iphone
I've tried all the above and it works fine from Xcode UI, but it was still failing for me when I ran xcodebuild from command line.
That was due to dependencies to other libraries and their pre-compile headers. When running from command line, looks like xcodebuild store/reads pre-compiled headers from here:
/var/folders/v0/ztxy9kls7sv05dpmvjgg_xwr0000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders
After cleaning up that folder, xcodebuild succeeded.
Solution 6 - Iphone
I had to manually delete ~/Library/Developer/Xcode/DerivedData/
Clean didn't work for me.
Solution 7 - Iphone
Specially if you build from command line or you have a build script, cleaning xcode target is not enough. You have to delete this folder.
The exact location of precompiled header can be found in the project, part of the folder path is random (I guess), esp after /var/folders/xx..xxx/C.
Target -> build settings => "Build locations" -> Precompiled headers cached path
Run Terminal and go to this folder and delete (use command),
#rm -fr SharedPrecompiledHeaders
Solution 8 - Iphone
use "command+shift+k" to clean your project, then you'll be fine.
Solution 9 - Iphone
Clean Your project and run
Product- > Clean Then, Run.