182

In my previous projects, I can find the .pch file under Supporting Files.

But now in Xcode 6, I couldn't find any .pch file. Any steps should I do to produce this file?

Ashwini Chougale
  • 1,093
  • 10
  • 26
Lie-An
  • 2,563
  • 3
  • 17
  • 20
  • Shame that you've not got an answer to this yet, I've just run across the same issue. Did you ever find an answer? – Darren Jun 29 '14 at 07:31

6 Answers6

434
  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

emotality
  • 12,795
  • 4
  • 39
  • 60
81

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

marciokoko
  • 4,988
  • 8
  • 51
  • 91
9

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.

Community
  • 1
  • 1
Hal Mueller
  • 7,019
  • 2
  • 24
  • 42
  • 3
    while Rob's answer is indeed worth reading, you might also include in your answer that the comments below the answer debate most of what he said. Rob's reputation plays big part of the deal. But one could agree that the answer is subjective, and represents Rob's personal choice not to have a .pch file in his projects. – user1244109 Aug 25 '15 at 22:07
6

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.

Lie-An
  • 2,563
  • 3
  • 17
  • 20
2

There is a minor error in the answer provided above.Please note that in the build setting under prefix.header you just need to type your .pch file name –

A_Curious_developer
  • 483
  • 1
  • 5
  • 12
1

In my case issue was getting ,no input file error

I fixed by Removing .pch file from project and adding again this work for me.hope this help someone.

Avijit Nagare
  • 8,482
  • 7
  • 39
  • 68