可以从 Xcode 项目中删除 Prefix.pch 文件吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4728225/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it OK to remove Prefix.pch file from the Xcode project?
提问by prosseek
The Xcode project generates Prefix.pch file automatically. When I deleted this file and tried to build, I got build error saying '*_Prefix.pch' file is missing.
Xcode 项目会自动生成 Prefix.pch 文件。当我删除此文件并尝试构建时,出现构建错误,提示“ *_Prefix.pch”文件丢失。
- Is Prefix.pch file is a must for compiling with Xcode?
- How can I build without the Prefix.pch file?
- Prefix.pch 文件是否是使用 Xcode 编译的必需文件?
- 如何在没有 Prefix.pch 文件的情况下进行构建?
回答by ughoavgfhw
In Xcode, go to your target's build settings (Command-Option-E, build tab) and uncheck Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER). You can also remove the value of the Prefix Header setting if you wish.
在 Xcode 中,转到目标的构建设置(Command-Option-E,构建选项卡)并取消选中 Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER)。如果您愿意,您还可以删除 Prefix Header 设置的值。
Prefix headers are compiled and stored in a cache, and then automatically included in every file during compilation. This can speed up compilation, and lets you include a file without adding an import statement to every file using it. They are not required, and actually slow compilation whenever you change them.
前缀头被编译并存储在缓存中,然后在编译期间自动包含在每个文件中。这可以加快编译速度,并让您包含一个文件,而无需向使用它的每个文件添加导入语句。它们不是必需的,并且在您更改它们时实际上会减慢编译速度。
回答by Praveen Gowlikar
Yes, you can compile and run the project without .pch file. In Xcode, go to your target's build settings (Command-Option-E, build tab) and uncheck Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER). You can also remove the value of the Prefix Header setting if u want.
是的,您可以在没有 .pch 文件的情况下编译和运行项目。在 Xcode 中,转到目标的构建设置(Command-Option-E,构建选项卡)并取消选中 Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER)。如果需要,您还可以删除 Prefix Header 设置的值。