In the header of the class, outside of interface declaration, I’ve declared global constants:
NSString * const gotFilePathNotification = @"gotFilePath";
NSString * const gotResultNotification = @"gotResultOfType";
gotResultNotification is used only in this class (yet), but I reference gotFilePathNotificaion in another class implementation. To do it, I import this header.
When I try to compile, I get a duplicate symbol linker error about gotFilePathNotification in this header. Why does it happen?
You have two identifier(s) with same name across two different compilation unit(s) at file scope. This violates One Definition Rule. Instead you need to –
Declare the global variables marking to have external linkage in a header file.
Now provide the definition in only one source file.
Now where ever you need to use these variables, include the header in the source file.