PCH File in Xcode 6

Add the pch file which is under Others in File-New...and don't forget to add it to your LLVM6.0 - Language section of Build Settings as Project/whateveryounamedyourpchfile.pch


  1. Make new file: ⌘cmd+N
  2. iOS/Mac > Other > PCH File > YourProject-Prefix.pch.
  3. Make sure you display "All" and not "Basic". (Blue buttons)
  4. Project > Build Settings > Search: "Prefix Header".
  5. Under "Apple LLVM 7.0" you will get the Prefix Header key.
  6. Type file directory. e.g: "$(SRCROOT)/$(PROJECT_NAME)/ProjectName-Prefix.pch".
  7. Clean project: ⌘cmd+⇧shift+K
  8. Build project: ⌘cmd+B

Prefix Header Image


I've found out that with Xcode 6. You need to manually create the PCH File.

File -> New -> File -> iOS -> C and C++ -> PCH File.


Rob Napier's answer at Why isn't ProjectName-Prefix.pch created automatically in Xcode 6? is worth reading. He points out that a PCH file is probably not a good idea, and suggests explicitly including .h files into modules that need them.

Tags:

Pch

Xcode6