问题
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
回答1:
- You'll need to create a PCH file named
ProjectName-Prefix.pch
. In the new file dialog you'll find PCH under Other. - 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' - Now add any headers you want globally included in your PCH file
- Clean and rebuild your project.
来源:https://stackoverflow.com/questions/29305205/pch-file-in-xcode-6-1