• 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: U vs. T in "nm -g" output..
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: U vs. T in "nm -g" output..


  • Subject: Re: U vs. T in "nm -g" output..
  • From: Chris Espinosa <email@hidden>
  • Date: Tue, 30 Aug 2005 14:50:10 -0700

On Aug 30, 2005, at 2:38 PM, Ando Sonenblick wrote:

OK... I answered my own question with "man nm" (shouldn't have had that
beer at lunch).

If you drink, don't post. Use a designated coder. :-)

But I still have a problem/question.

I have a project which does NOT define the function foo() (does not
include foo.cpp).

I have two static libraries that the project includes.

Lib A defines foo() (includes foo.cpp)
Lib B has calls to foo() (includes foo.h but does not include foo.cpp)

When I include both in the project and build the project I get a link
error that _foo is multiply defined.

When I run "nm -g" on Lib A I get

T  _foo

And when I run it on Lib B I get

U  _foo

By this I interpret that Lib A defines foo and that Lib B does not (U
meaning Undefined).

So the question is why the heck when I include both am I getting a
"multiply defined _foo" link error!?!?!?!

Link errors in Xcode are driving me crazy!

It looks like foo is defined in one library and not the other, good. Is it defined in your project that links to both of these?


What's the link order (determined by the order in which the libraries appear in the Link Binary with Libraries build phase)? If B comes before A, it may bring in A implicitly and reexport it, so that when you bring in A you get a second copy of it. Try reordering A before B, or omitting A entirely.

You can always add -Wl,-Y -Wl,999 to your Other Linker Flags and it will give you more information about where the symbol definitions are coming from. Posting the actual linker output from the build transcript will help, too.

Oh, and as this has nothing to do with Carbon development, please don't crosspost.

Chris
_______________________________________________
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: U vs. T in "nm -g" output..
      • From: David Burgun <email@hidden>
References: 
 >RE: U vs. T in "nm -g" output.. (From: "Ando Sonenblick" <email@hidden>)

  • Prev by Date: Re: U vs. T in "nm -g" output..
  • Next by Date: Re: U vs. T in "nm -g" output..
  • Previous by thread: RE: U vs. T in "nm -g" output..
  • Next by thread: Re: U vs. T in "nm -g" output..
  • Index(es):
    • Date
    • Thread