Search code examples
objective-cxcodeconstantsprefixundeclared-identifier

Precompiled Header with Constants issue


I have a few constants files "Constants.h" in my project that I am including in the Prefix.pch file to be available to all the classes in my project. They just contain a bunch of #define statements.

My classes don't recognize these constants (no autocomplete) and Xcode gives me "Undeclared Identifier" errors every time I use them. However when I run the project everything works fine (set to ignore errors).

Is there any way I can get rid of these warnings? #pragma ignore them in the prefix file or something? I've tried many options, including setting "precompile prefix header" to NO in build settings.

Any ideas?

EDIT: I have tried deleting derived data and cleaning / deleting build folder to no avail.

It might be worth noting that I have 3 targets in my project, and another project within this project.

Also, some of the #imports import normal classes. Like a category extension on UIFont and an Analytics class. Could this affect it?


Solution

  • I had a preprocessor macro in one of my targets that I moved from 'preprocessor macros' to 'preprocessor macros not used in precompiled headers' and that solved the problem.