iphone-体系结构i386的未定义符号:“ _ deflate”,从libMo中的PlatCompress(enumCompressOperation,CompressCookie *,void *,long)引用。

我正在使用SUP做本机iOS应用程序。 我已经包含了该库,并在Xcode中给出了链接路径。在构建时出现以下错误:

Undefined symbols for architecture i386:
  "_deflate", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in         libMo.a(tlplatcompress.o)
  "_deflateEnd", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in libMo.a(tlplatcompress.o)
  "_deflateInit_", referenced from:
      StartCompression(enumCompressOperation, unsigned char, long (*)(void*, void*, long), void*, void**) in libMo.a(tlplatcompress.o)
  "_deflateParams", referenced from:
      StartCompression(enumCompressOperation, unsigned char, long (*)(void*, void*, long), void*, void**) in libMo.a(tlplatcompress.o)
  "_inflate", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in libMo.a(tlplatcompress.o)
  "_inflateEnd", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in libMo.a(tlplatcompress.o)
  "_inflateInit_", referenced from:
      StartCompression(enumCompressOperation, unsigned char, long (*)(void*, void*,  long), void*, void**) in libMo.a(tlplatcompress.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

请帮助我解决该错误。我是使用SUP进行本机iOS开发的新手。

谢谢。

bapi asked 2019-11-08T07:49:58Z
4个解决方案
144 votes

我也有同样的错误。

从目标-> Build Phases选项卡-> Link Binaries With Libraries将libz.dylib添加到框架中,

希望对您有用。

注意:如果找不到libz.dylib,请尝试添加libz.tbd

Dhaval H. Nena answered 2019-11-08T07:50:35Z
39 votes

从Xcode 7开始,而不是添加libz.dylib,您应该这样做:

  • 转到项目Product选项卡
  • 搜索Product
  • Product添加为链接器标志(请参见屏幕截图)
  • Product菜单中,选择Clean,然后再次构建

lz link option

Abhi Beckert answered 2019-11-08T07:51:27Z
19 votes

体系结构i386的未定义符号:

  "_deflate", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in         libMo.a(tlplatcompress.o)
  "_deflateEnd", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in libMo.a(tlplatcompress.o)
  "_deflateInit_", referenced from:
      StartCompression(enumCompressOperation, unsigned char, long (*)(void*, void*, long), void*, void**) in libMo.a(tlplatcompress.o)
  "_deflateParams", referenced from:
      StartCompression(enumCompressOperation, unsigned char, long (*)(void*, void*, long), void*, void**) in libMo.a(tlplatcompress.o)
  "_inflate", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in libMo.a(tlplatcompress.o)
  "_inflateEnd", referenced from:
      PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in libMo.a(tlplatcompress.o)
  "_inflateInit_", referenced from:
      StartCompression(enumCompressOperation, unsigned char, long (*)(void*, void*,  long), void*, void**) in libMo.a(tlplatcompress.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我也有同样的问题,我想您没有包含libz.dylib库。

为此:

  1. 转到目标部分
  2. 构建阶段选项卡
  3. 将二进制文件与库链接
  4. 点击+按钮
  5. 搜索libz.dylib
  6. 单击添加按钮。
asheesh Verma answered 2019-11-08T07:52:40Z
10 votes

1.转到目标部分

2.构建阶段选项卡

3.将二进制文件与库链接

4.单击+按钮

5.搜索libz.tbd(或libz.dylib)

6.单击添加按钮。

Vinoth Anandan answered 2019-11-08T07:53:37Z
translate from https://stackoverflow.com:/questions/18053546/undefined-symbols-for-architecture-i386-deflate-referenced-from-platcompres