• 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
How to link with zlib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to link with zlib?


  • Subject: How to link with zlib?
  • From: Gord Peters <email@hidden>
  • Date: Mon, 7 Mar 2005 15:54:03 -0500

Hi all,

I have a bit of a tricky issue. I have a library which is a wrapper around zlib (for convenience) and I then use this library in a unit test suite (command line application).

First issue is that I don't know how to add libz.dylib to my XCode projects (since you can't just browse to /usr/lib in the Finder). Are the libraries in /usr/lib just intrinsically used without needing to be added to the list of external frameworks and libraries for the project? Or should I be using the version in /Developer?

The second issue is that I'm not sure where I should link against libz: in the library, or in the application? If I add -lz to the "Other Linker Flags" setting in the library project, then I get an error like this:

---
/usr/bin/libtool -static -o "libNBZlibWrapper/build/libNBZlibWrapper.a" "-LlibNBZlibWrapper/build" -framework Carbon -lz -filelist "libNBZlibWrapper/build/libNBZlibWrapper.build/libNBZlibWrapper.build/ Objects-normal/NBZlibWrapper.LinkFileList"
/usr/bin/libtool: can't locate file for: -lz
/usr/bin/libtool: file: -lz is not an object file (not allowed in a library)
---


So it seems like you can't really specify libraries to link against when you're creating a library yourself. But then it doesn't really make sense to link against zlib in every application which uses the wrapper library since they shouldn't have to care about the underlying libraries which the wrapper library uses.

If I only link against the wrapper library in my application (without using -lz), then I get this error:

---
ld: ../libNBZlibWrapper/build/libNBZlibWrapper.a(zlibengn.o) illegal reference to symbol: _deflate defined in indirectly referenced dynamic library /usr/lib/libz.1.dylib
---


Any help would be appreciated.
	Gord

_______________________________________________
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: How to link with zlib?
      • From: Markus Hitter <email@hidden>
    • Re: How to link with zlib?
      • From: Gord Peters <email@hidden>
  • Prev by Date: Re: compiler warnings when placing QT calls inside objC try block
  • Next by Date: Re: How to link with zlib?
  • Previous by thread: Re: compiler warnings when placing QT calls inside objC try block
  • Next by thread: Re: How to link with zlib?
  • Index(es):
    • Date
    • Thread