• 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
Re: Why am I always getting the linker error: 'duplicate symbol'...?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: Why am I always getting the linker error: 'duplicate symbol'...?
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 21 Sep 2009 13:24:13 -0700

On Mon, Sep 21, 2009 at 1:19 PM, Frederick C. Lee
<email@hidden> wrote:
> 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 ....'

Think about it: every time the preprocessor transcludes your header
file into a translation unit, it's going to emit another symbol
declaration.  The linker is going to try to combine all your compiled
object files, each one declaring its own "x".

You might want to review your favorite C documentation.  I always preferred K&R.

--Kyle Sluder
_______________________________________________

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: Jens Alfke <email@hidden>
References: 
 >Why am I always getting the linker error: 'duplicate symbol'...? (From: "Frederick C. Lee" <email@hidden>)

  • Prev by Date: Re: an app that never quits
  • Next by Date: Re: Tablet events from ordinary touchpad?
  • Previous by thread: Why am I always getting the linker error: 'duplicate symbol'...?
  • Next by thread: Re: Why am I always getting the linker error: 'duplicate symbol'...?
  • Index(es):
    • Date
    • Thread