链接器错误,同时包含另一个Xcode项目

时间:2017-03-15 07:50:13

标签: ios xcode linker-errors

我试图将此project包含在我的swift中。这个项目使用ffmpeg播放器。所以我把整个文件拖到我的项目下面。我有很多编译时错误,我解决了它们。最后我收到链接器错误。这些是错误:

    Undefined symbols for architecture x86_64:
  "_deflateReset", referenced from:
      _encode_frame in libavcodec.a(pngenc.o)
      _encode_frame in libavcodec.a(lclenc.o)
      _encode_frame in libavcodec.a(zmbvenc.o)
  "_deflateBound", referenced from:
      _encode_png in libavcodec.a(pngenc.o)
      _encode_apng in libavcodec.a(pngenc.o)
      _flashsv_decode_frame in libavcodec.a(flashsv.o)
      _encode_frame in libavcodec.a(lclenc.o)
  "_inflateInit_", referenced from:
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
      _rtmp_open in libavformat.a(rtmpproto.o)
      _swf_read_header in libavformat.a(swfdec.o)
      _decode_frame_apng in libavcodec.a(pngdec.o)
      _decode_frame_png in libavcodec.a(pngdec.o)
      _decode_text_chunk in libavcodec.a(pngdec.o)
      _flashsv_decode_init in libavcodec.a(flashsv.o)
      ...
  "_BZ2_bzDecompressInit", referenced from:
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
  "_deflateInit2_", referenced from:
      _png_enc_init in libavcodec.a(pngenc.o)
  "_inflate", referenced from:
      _http_read_stream in libavformat.a(http.o)
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
      _rtmp_open in libavformat.a(rtmpproto.o)
      _zlib_refill in libavformat.a(swfdec.o)
      _decode_frame_common in libavcodec.a(pngdec.o)
      _decode_text_chunk in libavcodec.a(pngdec.o)
      _flashsv_decode_frame in libavcodec.a(flashsv.o)
      ...
  "_inflateReset", referenced from:
      _flashsv_decode_frame in libavcodec.a(flashsv.o)
      _zlib_decomp in libavcodec.a(lcldec.o)
      _decode_frame in libavcodec.a(tscc.o)
      _zerocodec_decode_frame in libavcodec.a(zerocodec.o)
      _decode_frame in libavcodec.a(zmbv.o)
  "_inflateInit2_", referenced from:
      _http_read_header in libavformat.a(http.o)
  "_BZ2_bzDecompress", referenced from:
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
  "_BZ2_bzDecompressEnd", referenced from:
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
  "_iconv", referenced from:
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_iconv_open", referenced from:
      _avcodec_open2 in libavcodec.a(utils.o)
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_iconv_close", referenced from:
      _avcodec_open2 in libavcodec.a(utils.o)
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_uncompress", referenced from:
      _id3v2_read_internal in libavformat.a(id3v2.o)
      _mov_read_cmov in libavformat.a(mov.o)
      _swf_read_packet in libavformat.a(swfdec.o)
      _decode_frame in libavcodec.a(cscd.o)
      _decode_frame in libavcodec.a(dxa.o)
      _decode_block in libavcodec.a(exr.o)
      _g2m_decode_frame in libavcodec.a(g2meet.o)
      ...
  "_compress", referenced from:
      _encode_strip in libavcodec.a(tiffenc.o)
  "_compress2", referenced from:
      _flashsv2_encode_frame in libavcodec.a(flashsv2enc.o)
      _flashsv_encode_frame in libavcodec.a(flashsvenc.o)
  "_uregex_close", referenced from:
      _clearCacheSlotRegex in RegexKitLite.o
  "_u_errorName", referenced from:
      _userInfoDictionary in RegexKitLite.o
      _RKLNSExceptionForRegex in RegexKitLite.o
  "_inflateSync", referenced from:
      _flashsv_decode_frame in libavcodec.a(flashsv.o)
  "_uregex_findNext", referenced from:
      _rkl_find in RegexKitLite.o
      _rkl_splitArray in RegexKitLite.o
      _rkl_replaceAll in RegexKitLite.o
  "_uregex_appendReplacement", referenced from:
      _rkl_replaceAll in RegexKitLite.o
  "_uregex_end", referenced from:
      _rkl_find in RegexKitLite.o
  "_inflateEnd", referenced from:
      _http_close in libavformat.a(http.o)
      _http_read_header in libavformat.a(http.o)
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
      _rtmp_open in libavformat.a(rtmpproto.o)
      _swf_read_close in libavformat.a(swfdec.o)
      _decode_frame_apng in libavcodec.a(pngdec.o)
      _decode_frame_png in libavcodec.a(pngdec.o)
      ...
  "_deflate", referenced from:
      _encode_frame in libavcodec.a(pngenc.o)
      _flashsv_decode_frame in libavcodec.a(flashsv.o)
      _flashsv2_encode_frame in libavcodec.a(flashsv2enc.o)
      _encode_frame in libavcodec.a(lclenc.o)
      _encode_frame in libavcodec.a(zmbvenc.o)
  "_uregex_start", referenced from:
      _rkl_find in RegexKitLite.o
  "_uregex_reset", referenced from:
      _rkl_splitArray in RegexKitLite.o
      _rkl_replaceAll in RegexKitLite.o
  "_u_strlen", referenced from:
      _userInfoDictionary in RegexKitLite.o
  "_zlibCompileFlags", referenced from:
      _http_read_header in libavformat.a(http.o)
  "_uregex_find", referenced from:
      _rkl_find in RegexKitLite.o
  "_deflateInit_", referenced from:
      _flashsv_decode_frame in libavcodec.a(flashsv.o)
      _flashsv2_encode_frame in libavcodec.a(flashsv2enc.o)
      _encode_init in libavcodec.a(lclenc.o)
      _encode_init in libavcodec.a(zmbvenc.o)
  "_uregex_open", referenced from:
      _getCachedRegex in RegexKitLite.o
  "_uregex_appendTail", referenced from:
      _rkl_replaceAll in RegexKitLite.o
  "_uregex_groupCount", referenced from:
      _getCachedRegex in RegexKitLite.o
  "_deflateEnd", referenced from:
      _png_enc_close in libavcodec.a(pngenc.o)
      _flashsv_decode_frame in libavcodec.a(flashsv.o)
      _flashsv2_encode_frame in libavcodec.a(flashsv2enc.o)
      _flashsv_encode_init in libavcodec.a(flashsvenc.o)
      _flashsv_encode_end in libavcodec.a(flashsvenc.o)
      _encode_end in libavcodec.a(lclenc.o)
      _encode_init in libavcodec.a(zmbvenc.o)
      ...
  "_uregex_setText", referenced from:
      _clearCacheSlotSetTo in RegexKitLite.o
      _setCacheSlotToString in RegexKitLite.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

据我所知,这些是.a文件中的错误。当我运行原始项目时运行正常,但当我将其包含在我的项目中时,我收到了这些错误。我该如何解决这些错误?

2 个答案:

答案 0 :(得分:0)

需要添加一些dylib框架。 添加" libz.dylib"来自目标的框架 - > Build Phases选项卡 - >链接二进制文件与库, 你可以通过错误键搜索框架 希望这对你有用。

答案 1 :(得分:0)

如果有人在Unity 2019.3+中构建到Xcode 11.5+,并且出现Mach-O-Link错误或_inflate错误或链接失败,则将对其进行修复。但是,请记住将libz.tbd添加到UnityFramework Targets条目中,然后转到BuildPhases>'Link Binary with Libraries'。然后在顶部添加libz.tbd文件,将其添加到UnityFramework Target中。这对我来说是固定的。