1

I have looked all over and cannot find a solution to this problem.

The problem involves adding a header file to an xcode 6.1 project. What I want to be able to do is add a header file that is automatically imported to each of the files I create.

i.e.

I create a.h & a.m.

Where previouslyMade.pch or previouslyMade.h definitions are already included.

I've looked through build settings and there isn't an option to update the .pch file.

Is there a solution to this or have I got to import a .h file every time I make a new file?

Thanks

cwiggo
  • 2,541
  • 9
  • 44
  • 87
  • Chris can you clarify your question a little bit more please.Build "Settings -> Prefix Header" is the place where you specify your .pch. – Mike.R Mar 27 '15 at 17:20

1 Answers1

7
  1. You'll need to create a PCH file named ProjectName-Prefix.pch. In the new file dialog you'll find PCH under Other.
  2. Go to Project > Build Settings and search "Prefix Header". Under "Apple LLVM 6.0 - Language" add your PCH file: ProjectName/ProjectName-Prefix.pch note: make sure you select 'All' not 'Basic'
  3. Now add any headers you want globally included in your PCH file
  4. Clean and rebuild your project.
cwiggo
  • 2,541
  • 9
  • 44
  • 87
DanielG
  • 2,237
  • 1
  • 19
  • 19
  • Hi, see the image [here](http://imgur.com/n3wEsFM). When I search for prefix header in build settings, there are no hits – cwiggo Mar 30 '15 at 09:37
  • 1
    @Chris, select the "All" tab instead of "Basic". – DanielG Mar 30 '15 at 18:39
  • 1
    Thanks! Just what I needed :) I've adjusted the answer a tiny bit to make it clearer for others in the future! Thanks again! – cwiggo Mar 30 '15 at 19:17