问题
In Xcode 6.1, creating a new project does not create a precompiled header file using the single view iOS project template. If I add one manually, any definitions in the pch file are not available in any other source files.
I've looked at many threads and questions and tried cleaning, re-buiding, re-starting, deleting derived data and manually removing the CACHE_ROOT/SharedPrecompileHeaders folder. All to no avail, though.
Some info suggests ticking to include in targets, but this is disabled for pch and other header files now.
See comment below.
回答1:
Have you tried adding the path of the pch file?
Go to your project -> Build Settings -> Apple LLVM 6.0 Language.
Under it, set the following things:
- Precompile Prefix Header: Set it to YES
- Prefix Header: Set the path to the pch file
Update 2018/09/23: In Xcode10 it is under Apple Clang - Language
来源:https://stackoverflow.com/questions/26822953/xcode-6-1-precompiled-headers