• 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: multiple definitions of symbol _xxxx
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple definitions of symbol _xxxx


  • Subject: Re: multiple definitions of symbol _xxxx
  • From: Ken Tozier <email@hidden>
  • Date: Fri, 9 Feb 2007 03:11:38 -0500


On Feb 9, 2007, at 2:34 AM, Steve Christensen wrote:


On Feb 8, 2007, at 11:30 PM, Eric Albert wrote:

On Feb 8, 2007, at 11:26 PM, Steve Christensen wrote:

On Feb 8, 2007, at 10:35 PM, Ken Tozier wrote:

I know this is really basic but after 5 years of using #import in Objective C and never having to deal with #include conflicts the following error has me stumped.

I'm seeing a bunch of the following errors in the XCode build window of a loadable Carbon bundle.

multiple definitions of symbol _SOME_SYMBOL_NAME

And this in the build details pane

/usr/bin/ld: multiple definitions of symbol _SOME_SYMBOL_NAME
/<path>/Objects-normal/i386/SourceFile1.o definition of _SOME_SYMBOL_NAME in section (__TEXT,__text)
/<path>/Objects-normal/i386/SourceFile2.o definition of _SOME_SYMBOL_NAME in section (__TEXT,__tex)


"_SOME_SYMBOL_NAME" is in the header file for a 3rd party library I'm using and I have several of my own source files that need to make use of this library. I think there is a circular reference going on but don't remember how to solve it.

I've seen that sort of thing before with an inline function defined in a header that is separately included by several .cpp files. If the inline function doesn't have the "inline" keyword in front, i.e.,


    void foo() { ... }

instead of

    inline void foo() { ... }

then multiple copies are created and then the linker later barfs on it. Could that be what's happening in your case?

Actually, I usually see this when the function is declared as

	inline void foo() { ... }

instead of

	static inline void foo() { ... }

The lack of the 'static' keyword means that the function isn't localized to the current translation unit during compilation, so the compiler, while inlining it where it's referenced, may (will?) also generate an out of line copy which'll be exported from the module. #include the header in two files and you'll end up with two out of line copies of the same function.

Hmmm...interesting. I have several headers with just "inline ..." and everything works great. I just get the errors when I forget the inline part.

I just pored through the headers for the 3rd party lib and found one of the problem symbols. It's defined like this


inline bool8 XTAPI ISANCHBOX2(const xtbox *bptr)


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: multiple definitions of symbol _xxxx
      • From: Thomas Engelmeier <email@hidden>
References: 
 >multiple definitions of symbol _xxxx (From: Ken Tozier <email@hidden>)
 >Re: multiple definitions of symbol _xxxx (From: Steve Christensen <email@hidden>)
 >Re: multiple definitions of symbol _xxxx (From: Eric Albert <email@hidden>)
 >Re: multiple definitions of symbol _xxxx (From: Steve Christensen <email@hidden>)

  • Prev by Date: Re: multiple definitions of symbol _xxxx
  • Next by Date: Re: multiple definitions of symbol _xxxx
  • Previous by thread: Re: multiple definitions of symbol _xxxx
  • Next by thread: Re: multiple definitions of symbol _xxxx
  • Index(es):
    • Date
    • Thread