Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix PCH error?

People also ask

How do I view PCH files?

You need a suitable software like Visual C to open a PCH file. Without proper software you will receive a Windows message "How do you want to open this file?" or "Windows cannot open this file" or a similar Mac/iPhone/Android alert.

What is PCH H in C++?

pch stands for precompiled header. In computer programming, a precompiled header is a (C or C++) header file that is compiled into an intermediate form that is faster to process for the compiler.


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...


Go to Xcode Preferences->Locations (as mentioned in the answer by wcochran) and simply rename your DerivedData folder. I simply changed mine from "DerivedData" to "DerivedData2" and that forced the system to stop referencing the old location. This fixed it for me when none of the other answers worked. See pic:

enter image description here