Linker error on const values
I am trying to create some string constants so I have the following:
extern NSString* const CONSTANT_ONE;
NSString *const CONSTANT_ONE = @"CONSTANT_ONE";
#import "Constants.h" ... snip NSString* something = CONSTANT_ONE;
Constants.m is listed in the "Compile Sources" bit of the target's build phases and is a member of the target when I look in its "Target Membership" section of the sidebar.
When I try to compile I get an error like:
Undefined symbols for architecture i386: "_CONSTANT_ONE", referenced from: -[SomeOtherFile someMethod:] in SomeOtherFile.o
I think I might be misunderstanding something basic here - can anyone help me with this error please?
The code in my initial question was correct. I don't know why but simply closing and re-opening Xcode solved the problem and it built fine. Just Xcode getting itself confused.