Re: multiple definitions of symbol _xxxx
Re: multiple definitions of symbol _xxxx
- Subject: Re: multiple definitions of symbol _xxxx
- From: Eric Albert <email@hidden>
- Date: Thu, 8 Feb 2007 23:30:37 -0800
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.
-Eric
_______________________________________________
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