I'm still a bit confused about the #import
instruction in Objective-C. I have a header file (Common.h) where I keep some constant NSStrings that are used throughout the application. So far I have used #import "Common.h"
in 2 classes, and I get a build error:
duplicate symbol _EX_XML_URL in /Users/username/Library/Developer/Xcode/DerivedData/projectname-ffvcivanbwwtrudifbcjntmoopbo/Build/Intermediates/projectname.build/Debug-iphonesimulator/projectname.build/Objects-normal/i386/NewsView.o and /Users/username/Library/Developer/Xcode/DerivedData/projectname-ffvcivanbwwtrudifbcjntmoopbo/Build/Intermediates/projectname.build/Debug-iphonesimulator/projectname.build/Objects-normal/i386/ViewController.o for architecture i386
EX_XML_URL is declared as:
// // Common.h // Group of common constants used through out the application /* * Constant strings available to application */ #import <Foundation/NSString.h> NSString* EX_XML_URL = @"http://myurl.com/xmldata"; // URL for XML data NSString* EX_NO_CONNECTION = @"Network not availble"; NSString* EX_DEFAULT_IMAGE = @"logo.png";
I had the impression ( from this post ) that #import
protects against header files that are included twice. What part am I missing here?
source share