XCode中静态链接ID3Lib的问题



我正在尝试将id3lib静态链接到我的Xcode项目。我在其他线程中找到了一些答案,建议将作为链接器标志添加为.a文件的完整路径。这有效,但会产生大量错误:

Undefined symbols for architecture x86_64:
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::copy(char*, unsigned long, unsigned long) const", referenced from:
      dami::io::StringReader::readChars(unsigned char*, unsigned int) in libid3.a(tag_impl.o)
      dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
      dami::io::StringReader::readChars(unsigned char*, unsigned int) in libid3.a(tag_parse_lyrics3.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(char const*) const", referenced from:
      ID3_TagImpl::IsV2Tag(ID3_Reader&) in libid3.a(tag_impl.o)
      dami::mm::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_musicmatch.o)
      dami::id3::v1::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_v1.o)
      dami::lyr3::v1::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_lyrics3.o)
      dami::lyr3::v2::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_lyrics3.o)
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      void std::__1::vector<ID3_Field*, std::__1::allocator<ID3_Field*> >::__push_back_slow_path<ID3_Field* const>(ID3_Field* const&) in libid3.a(frame_impl.o)
  "std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
      std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >::reserve(unsigned long) in libid3.a(tag.o)
      std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >::__grow_by_and_replace(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned char const*) in libid3.a(tag.o)
      std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, 

等等。同样,谷歌搜索表明,问题可能是标准库的选择。因此,我尝试将C 标准库字段从"编译器默认值"切换为" Libstdc "(并且我仍会遇到大量错误)或" LIBC " - 而且我的错误较少,即:

Undefined symbols for architecture x86_64:
  "_compress", referenced from:
      dami::io::CompressedWriter::flush() in libid3.a(io_decorators.o)
  "_iconv", referenced from:
      dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
  "_iconv_close", referenced from:
      dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
  "_iconv_open", referenced from:
      dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
  "_uncompress", referenced from:
      dami::io::CompressedReader::CompressedReader(ID3_Reader&, unsigned int) in libid3.a(io_decorators.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我不知道如何解决这个问题。如果我将库的完整路径作为链接标志删除,则所有内容似乎都起作用,但是库是动态链接的(对我不起作用)。我在Mac OS X 10.10上;ID3Lib是通过Homebrew安装的(手动安装测试导致了类似的结果)。

有人有线索吗?

谢谢Daniele

访问项目设置中的二进制文件链接二进制文件 在项目设置中,然后将项目与系统库libz(_compress,_uncompress)和libiconv(_iconv,_iconv_close,_iconv_close,_iconv_open)链接。

相关内容

  • 没有找到相关文章