• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why am I always getting the linker error: 'duplicate symbol'...?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why am I always getting the linker error: 'duplicate symbol'...?


  • Subject: Why am I always getting the linker error: 'duplicate symbol'...?
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Mon, 21 Sep 2009 13:19:30 -0700

I'm trying to replace #define directives with c datatype directives.Example:

(1) #define x 123

versus...

(2) const unsigned x = 123;

I place this at the top of the .h (or .m) file, outside of any class or
method as stand alone.

However, every time I try to use the (2) declaration (within a .h file) the
linker gives the error: 'duplicate symbol _x in ....'

I tried placing the (2) declaration at the top of a .m or .c file, but I get
the same linker error.

I've declared global constants in another application without a problem.

I've checked the compiler type within the build: gcc 4.2

What am I doing wrong?
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why am I always getting the linker error: 'duplicate symbol'...?
      • From: Jeremy Pereira <email@hidden>
    • Re: Why am I always getting the linker error: 'duplicate symbol'...?
      • From: Jesper Storm Bache <email@hidden>
    • Re: Why am I always getting the linker error: 'duplicate symbol'...?
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: an app that never quits
  • Next by Date: Re: Core Data threading fun
  • Previous by thread: Re: NSManagedObject Initialization Methods Not Called
  • Next by thread: Re: Why am I always getting the linker error: 'duplicate symbol'...?
  • Index(es):
    • Date
    • Thread