• 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: linking in static libraries under xcode?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: linking in static libraries under xcode?


  • Subject: Re: linking in static libraries under xcode?
  • From: Justin Walker <email@hidden>
  • Date: Fri, 6 Feb 2004 16:23:09 -0800

On Friday, February 6, 2004, at 04:01 AM, Bill Northcott wrote:

On Thursday, February 5, 2004, at 04:33 PM, Bill Northcott wrote:

On 06/02/2004, at 3:11 AM, Shantonu Sen wrote:
[snip]
Not to derail the Xcode discussion, but you are certainly wrong that
'-lfoo' fails to work with libfoo.a, using gcc/ld.  I use this without
problem (but I have yet to convince Xcode to work with my project, a
separate issue).
What do you mean by gcc/ld? How was libfoo.a created?

I mean "gcc or ld"; I should have been less cryptic. Sorry.

If I try something like
ld -o someexecutable grog.o bar.o -lfoo
where libfoo.a is an archive made with
ar -cru -o libfoo.a yuch.o grok.o blob.o
ranlib -s libfoo.a
I will get
libfoo.a is not a valid object file
and it wil break.

Yup. That's no surprise. ".a"s are (should be) created by the 'ar' command. That's what I do, and it works.


Also, if you do "ld -o bar glitch.o -lfoo", you probably won't be very happy either. Try
gcc -o bar glitch.o -lfoo
for better results. To use 'ld', you need to throw in a bunch of stuff like (what we used to call, back in the day) crt0.o. You should be able to see a good 'ld' line in action by using "gcc -v".


Are you saying this is different for you?

Only in that I'm different commands and arguments, and getting different results :-}


Hope that helps, or at least, sheds light...

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large  *
Institute for General Semantics        | Some people have a mental
                                       |  horizon of radius zero, and
                                       |  call it their point of view.
                                       |     -- David Hilbert
*--------------------------------------*-------------------------------*
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: linking in static libraries under xcode?
      • From: Justin Walker <email@hidden>
References: 
 >Re: linking in static libraries under xcode? (From: Bill Northcott <email@hidden>)

  • Prev by Date: Re: Couldn't Save Document. Error
  • Next by Date: Re: linking in static libraries under xcode?
  • Previous by thread: Re: linking in static libraries under xcode?
  • Next by thread: Re: linking in static libraries under xcode?
  • Index(es):
    • Date
    • Thread