使用自定义cocoapod会产生编译错误(架构armv7的未定义符号:)

时间:2013-08-26 19:38:10

标签: ios xcode cocoapods

我为自己的内部使用构建了自己的pod。 pod spec lint工作正常但是当我试图实际使用它时,它给了我以下编译错误:

Undefined symbols for architecture armv7:
  "___gxx_personality_sj0", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for CAXException in libPods.a(ExtAudioFileConvert.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "std::__throw_bad_alloc()", referenced from:
      std::_Vector_base<AudioBufferList*, std::allocator<AudioBufferList*> >::_M_allocate(unsigned long) in libPods.a(ExtAudioFileConvert.o)
  "CAStreamBasicDescription::CAStreamBasicDescription()", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "___cxa_allocate_exception", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "___cxa_throw", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "operator new[](unsigned long)", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "___cxa_begin_catch", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "operator new(unsigned long)", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
      std::_Vector_base<AudioBufferList*, std::allocator<AudioBufferList*> >::_M_allocate(unsigned long) in libPods.a(ExtAudioFileConvert.o)
  "std::__throw_length_error(char const*)", referenced from:
      std::vector<AudioBufferList*, std::allocator<AudioBufferList*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<AudioBufferList**, std::vector<AudioBufferList*, std::allocator<AudioBufferList*> > >, AudioBufferList* const&) in libPods.a(ExtAudioFileConvert.o)
  "___cxa_free_exception", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "_OBJC_CLASS_$_MPMusicPlayerController", referenced from:
      objc-class-ref in libPods.a(AudioManager.o)
  "___cxa_end_catch", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "std::terminate()", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
  "operator delete(void*)", referenced from:
      _GetConvertedData in libPods.a(ExtAudioFileConvert.o)
      std::vector<AudioBufferList*, std::allocator<AudioBufferList*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<AudioBufferList**, std::vector<AudioBufferList*, std::allocator<AudioBufferList*> > >, AudioBufferList* const&) in libPods.a(ExtAudioFileConvert.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我怀疑podspec中的框架设置不正确,因为这是我写的第一个pod,我可能会遇到一些错误。

提前致谢。

1 个答案:

答案 0 :(得分:2)

正式回答我发布的问题。我需要执行以下操作来修复它:

  • 链接C ++标准库:(感谢@ H2CO3)
    • s.library = 'stdc++'添加到 podspec
  • 链接MediaPlayer框架:(感谢@ H2CO3)
    • s.frameworks = 'MediaPlayer'添加到 podspec
  • CAStreamBasicDescription 的问题已通过以下答案修复:Trouble linking Tim Bolstad's Core Audio Example