• 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: Linker fails to link in static library SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linker fails to link in static library SOLVED


  • Subject: Re: Linker fails to link in static library SOLVED
  • From: Philip White <email@hidden>
  • Date: Mon, 17 Jan 2011 17:49:39 -0600


On Jan 17, 2011, at 5:00 PM, Xochitl Lunde wrote:


I add the resulting library to another
> project, make sure it is listed in the "Link Binary with Libraries"
> phase for the appropriate target, and try to build, but the linker
> gives me an error for every reference to a function from the library.
>

What happens if you add the library path to "Library Search Paths" and add "-lyourlib" to "Other Linker Flags" field?  Will it link then? You could also add the full path to "Other Linker Flags" field: "$path/path/yourlib.a" (This should be approx. the same thing as adding it to the "Link Binary with Libraries" field, but just for the sake of determining if something else will work you can try it.)

Could your dependencies be out of order?

Could you be building this new library only for 1 architecture, but not the first architecture that tries to link?  Should be able to run $> file yourlib.a and see what architectures it built for and whether or not Xcode REALLY built a static library, or if it built a dynamic library with a .a file extension.  In your library info it should say "Mach-O Type" = Static Library (I think).


Hi,
  Thanks for all of the responses I got for this, on and off-list. I have to sheepishly admit that it was a problem of an omitted "extern "C"{" in the library header file. I've never before used C++ (I'm an obj-c programmer, like most of you guys, I imagine). The library was laid out as C, but I was calling it from some C++ source files. Sorry for wasting your time! In my defense, the linker error was not terribly helpful, but then, I don't know enough about C++ to know if the linker could generate a more helpful message!

Thanks,
  Philip
 _______________________________________________
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: Linker fails to link in static library SOLVED
      • From: Mark Wagner <email@hidden>
References: 
 >Re: Linker fails to link in static library (From: Xochitl Lunde <email@hidden>)

  • Prev by Date: Re: Linker fails to link in static library
  • Next by Date: Re: Linker fails to link in static library SOLVED
  • Previous by thread: Re: Linker fails to link in static library
  • Next by thread: Re: Linker fails to link in static library SOLVED
  • Index(es):
    • Date
    • Thread