简体   繁体   English

Xcode 6.1中的.pch文件

[英].pch File in Xcode 6.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. 问题涉及到将头文件添加到xcode 6.1项目。 What I want to be able to do is add a header file that is automatically imported to each of the files I create. 我想要做的是添加一个头文件,该头文件会自动导入到我创建的每个文件中。

ie

I create ah & am 我创造啊与我

Where previouslyMade.pch or previouslyMade.h definitions are already included. 已包含previousMade.pch或previousMade.h定义的位置。

I've looked through build settings and there isn't an option to update the .pch file. 我已经浏览了构建设置,没有选择更新.pch文件的选项。

Is there a solution to this or have I got to import a .h file every time I make a new file? 是否有解决方案,或者每次创建新文件时都必须导入.h文件?

Thanks 谢谢

  1. You'll need to create a PCH file named ProjectName-Prefix.pch . 您需要创建一个名为ProjectName-Prefix.pch的PCH文件。 In the new file dialog you'll find PCH under Other. 在新文件对话框中,您会在其他下找到PCH。
  2. Go to Project > Build Settings and search "Prefix Header". 转到Project > Build Settings然后搜索“前缀头”。 Under "Apple LLVM 6.0 - Language" add your PCH file: ProjectName/ProjectName-Prefix.pch note: make sure you select 'All' not 'Basic' 在“ Apple LLVM 6.0-语言”下,添加您的PCH文件: ProjectName/ProjectName-Prefix.pch注意:确保选择“全部”而不是“基本”
  3. Now add any headers you want globally included in your PCH file 现在,添加要全局包含在PCH文件中的所有标题
  4. Clean and rebuild your project. 清理并重建您的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM