问题
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.
- Is Prefix.pch file is a must for compiling with Xcode?
- How can I build without the Prefix.pch file?
回答1:
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.
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.
回答2:
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.
来源:https://stackoverflow.com/questions/4728225/is-it-ok-to-remove-prefix-pch-file-from-the-xcode-project