ios 架构 i386 的未定义符号:“_deflate”,引用自 libMo.a 中的 PlatCompress(enumCompressOperation, CompressCookie*, void*, long)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18053546/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 00:36:12  来源:igfitidea点击:

Undefined symbols for architecture i386: "_deflate", referenced from PlatCompress(enumCompressOperation, CompressCookie*, void*, long) in libMo.a

iphoneiossybasesup

提问by bapi

I'm doing native iOS application using SUP.As per documentation; i have included the library and given the link path in Xcode. While building getting following error:

我正在使用 SUP.As per documentation 做原生 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)

Please help me how to solve this error.I'm new to native iOS development using SUP.

请帮助我如何解决这个错误。我是使用 SUP 进行原生 iOS 开发的新手。

Thanks.

谢谢。

回答by Dhaval H. Nena

I also had a same error.

我也有同样的错误。

Add libz.dylibto framework from the target -> Build Phases tab -> Link Binaries With Libraries,

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

hope that will work for you.

希望这对你有用。

Note: If libz.dylibnot found, try adding libz.tbd

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

回答by Abhi Beckert

Starting with Xcode 7, instead of adding libz.dylib, you should do this:

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

  • Go to the project Build Settingstab
  • Search for Other Linker Flags
  • Add -lzas a linker flag (see screenshot)
  • In the Productmenu, select Cleanbefore building again
  • 转到项目Build Settings选项卡
  • 搜索 Other Linker Flags
  • 添加-lz为链接器标志(见截图)
  • Product菜单中,Clean再次构建之前选择

lz link option

lz链接选项

回答by asheesh Verma

Undefined symbols for architecture i386:

架构 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)

I had also the same problem,I think you didn't include the libz.dylib library.

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

To do so:

这样做:

  1. go to target section
  2. Build Phases tab
  3. Link Binaries With Libraries
  4. click on + button
  5. search libz.dylib
  6. clcik on add button.
  1. 转到目标部分
  2. 构建阶段选项卡
  3. 将二进制文件与库链接
  4. 点击 + 按钮
  5. 搜索 libz.dylib
  6. 单击添加按钮。

回答by Vinoth Anandan

1.go to target section

1.转到目标部分

2.Build Phases tab

2.构建阶段选项卡

3.Link Binaries With Libraries

3.用库链接二进制文件

4.click on + button

4.点击+按钮

5.search libz.tbd (or libz.dylib)

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

6.click on add button.

6.点击添加按钮。