zLib链接错误XCode 4,未定义的符号

时间:2012-01-21 01:16:36

标签: xcode linker-errors zlib dylib

链接错误:

Undefined symbols for architecture i386:  "_unzOpen", referenced from:

我的xcode项目中有一个libz.dylib(使用库构建阶段/链接二进制文件) 也可以看-lz link flag

Ld Debug/DemoOSX_d.app/Contents/MacOS/DemoOSX_d normal i386
cd /Projects/Scorpio/DemoOSX
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Projects/Scorpio/DemoOSX/Debug -L/Projects/Scorpio/DemoOSX/../LibMacOS -F/Projects/Scorpio/DemoOSX/Debug -F/Developer/SDKs/MacOSX10.7.sdk/usr/lib -filelist /Projects/Scorpio/DemoOSX/Debug/DemoOSX.build/Objects-normal/i386/DemoOSX_d.LinkFileList -mmacosx-version-min=10.7 -lz /Projects/Scorpio/DemoOSX/../LibMacOS/SysAudio_d.a /Projects/Scorpio/DemoOSX/../LibMacOS/SysUtils_d.a -lexpat -logg -lvorbis -lvorbisfile /Projects/Scorpio/DemoOSX/../LibMacOS/SysMath_d.a /Projects/Scorpio/DemoOSX/../LibMacOS/SysMemManager_d.a -framework OpenAL -framework SDL -framework Cocoa -o /Projects/Scorpio/DemoOSX/Debug/DemoOSX_d.app/Contents/MacOS/DemoOSX_d

1)尝试在文件检查器中检查扩展名 - mach o dynamic library

2)尝试构建32/64位app

3)添加其他链接器标志“usr / lib / libz.dylib”

4)尝试添加标题搜索路径/ usr / include

没有任何帮助:(,可能需要自己构建

ARCHS 32位英特尔 SDK_ROOT最新10.7 GCC_VERSION Apple LLVM 3.0

1 个答案:

答案 0 :(得分:2)

unzOpen函数是“minizip”的一部分,“minizip”是zlib的附加组件,不包含在Apple的zlib版本中。你需要去zlib.net获取minizip的源代码。