Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6533925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:11:19+00:00 2026-05-25T10:11:19+00:00

I am still a bit confused about the #import statement in Objective-C. I have

  • 0

I am still a bit confused about the #import statement in Objective-C. I have a header file (Common.h) where I holding 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 like:

    //
    //  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 was under the impression (from this post) that #import guards against header files being included twice. What part am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:11:20+00:00Added an answer on May 25, 2026 at 10:11 am

    In your header (.h) file, you should only declare the constant, and then you should define the constant and assign a value in your implementation (.m) file.

    in Common.h

    extern NSString *const EX_XML_URL;
    

    in Common.m

    NSString *const EX_XML_URL = @"http://myurl.com/xmldata";
    

    It’s ok if the only thing you have in Common.m is constant definitions, if that’s the way things work out. Just make sure Common.m is included in the files that are compiled and linked into your target.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am still a bit confused about something about FormsAuthenticationTicket and the actual cookie
hello im still a student and im a bit confused about stacking and queuing
I'm a bit confused about multitasking. I have a timer app which I am
You guys were very helpful yesterday. I am still a bit confused here though.
Still new to Objective C, and I'm having some trouble that I just can't
I still have a large number of floppies. On some of them there probably
I am bit confused about the difference between the usage of std::remove algorithm. Specifically
I'm a bit confused about how Ruby handles the creation of Enumerators. Block-based iteration
I am a little bit confused about 2 things. Firstly when I create an
I recently began learning Python, and I am a bit confused about how packages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.