63

我正在使用 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 开发的新手。

谢谢。

4

4 回答 4

154

我也有同样的错误。

libz.dylib从目标添加到框架 -> 构建阶段选项卡 -> 将二进制文件与库链接,

希望这对你有用。

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

于 2013-11-30T08:26:36.213 回答
43

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

  • 转到项目Build Settings选项卡
  • 搜索Other Linker Flags
  • 添加-lz为链接器标志(见屏幕截图)
  • Product菜单中,Clean再次构建之前选择

lz链接选项

于 2015-12-08T22:35:59.177 回答
19

架构 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. 点击添加按钮。
于 2014-09-15T11:32:25.880 回答
12

1.转到目标部分

2.构建阶段选项卡

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

4.点击+按钮

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

6.点击添加按钮。

于 2016-03-18T09:10:26.920 回答