如何将预编译的头文件添加到ios项目中? [英] How do I add a precompiled header file to my ios project?
本文介绍了如何将预编译的头文件添加到ios项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找创建预编译的头文件,以避免在项目的每个头中包含相同的调试和跟踪库。
I'm looking to create a precompiled header file, to avoid having to include the same debug and tracking libraries in every header in the project.
我是创建了一个名为-Prefix.pch的文件:
I've created a file called -Prefix.pch:
#ifdef __OBJC__
#import "Blah.h"
#import "Blarg.h"
#endif
并将其添加到项目中。还有什么我应该做的,或者现在应该做些什么(假设我做一个项目干净并重新编译)?
and added it to the project. Is there anything more I'm supposed to do, or should things just work now (assuming I do a project clean and recompile)?
推荐答案
设置目标的构建设置如下:
Set the target's build settings as follows:
GCC_PRECOMPILE_PREFIX_HEADER=YES
GCC_PREFIX_HEADER="Prefix.pch"
请注意,如果您更喜欢使用Xcode的UI,可以在Build Settings搜索字段中填写这些键。你的构建设置。
Note that you can plop these keys in the Build Settings search field, if you prefer to use Xcode's UI for your build settings.
这篇关于如何将预编译的头文件添加到ios项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文