如何将预编译的头文件添加到ios项目中?

时间:2021-09-01 07:04:09

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.

我正在寻找创建一个预编译的头文件,以避免在项目的每个头中包含相同的调试和跟踪库。

I've created a file called -Prefix.pch:

我创建了一个名为-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)?

并将其添加到项目中。还有什么我应该做的,或者现在应该做些什么(假设我做了一个项目干净并重新编译)?

1 个解决方案

#1


33  

Set the target's build settings as follows:

设置目标的构建设置如下:

GCC_PRECOMPILE_PREFIX_HEADER=YES
GCC_PREFIX_HEADER="Prefix.pch"

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.

请注意,如果您希望将Xcode的UI用于构建设置,则可以在“构建设置”搜索字段中填充这些键。

#1


33  

Set the target's build settings as follows:

设置目标的构建设置如下:

GCC_PRECOMPILE_PREFIX_HEADER=YES
GCC_PREFIX_HEADER="Prefix.pch"

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.

请注意,如果您希望将Xcode的UI用于构建设置,则可以在“构建设置”搜索字段中填充这些键。

相关文章