在iOS中导入zlib时出错:找不到符号collect2:ld [英] error when import zlib in iOS: symbol(s) not found collect2: ld

查看:150
本文介绍了在iOS中导入zlib时出错:找不到符号collect2:ld的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的iPhone应用程序中包含了<zlib.h>,并且源代码正在模拟Brad Larson提供的Molecules的示例代码,但是,当我构建该项目时,它返回如下错误.谁能为我指出这是库链接问题还是我遗漏了其他东西?

I have included <zlib.h> in my iphone application and the source code I was mocking up the sample code of Molecules provided by Brad Larson, however, when I build the project, it returns the error as below. Can anyone point out for me whether this is a library linking problem or am I missing something else?

"_deflate", referenced from: -[NSData(Gzip) gzipDeflate] in NSData+Gzip.o "_inflateEnd", 
referenced from: -[NSData(Gzip) initWithGzippedData:] in NSData+Gzip.o "inflateInit2", 
referenced from: -[NSData(Gzip) initWithGzippedData:] in NSData+Gzip.o "_inflate", 
referenced from: -[NSData(Gzip) initWithGzippedData:] in NSData+Gzip.o "_deflateEnd", 
referenced from: -[NSData(Gzip) gzipDeflate] in NSData+Gzip.o "deflateInit2", referenced 
from: -[NSData(Gzip) gzipDeflate] in NSData+Gzip.o ld: symbol(s) not found collect2: ld 
returned 1 exit status

推荐答案

在目标的Build Settings选项卡中,向下滚动到Other Linker Flags部分,并确保-lz在该字段中.这将链接到内置的zlib,您的错误应该消失了.

In your Target's Build Settings tab, scroll down to the Other Linker Flags section and make sure -lz is in the field. This will link against the built-in zlib, and your error should go away.

更改链接器标志后,必须从Product菜单中选择Clean,然后再重新构建.

After changing the Linker Flags you must select Clean from the Product menu before building again.

这篇关于在iOS中导入zlib时出错:找不到符号collect2:ld的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆