iOS中出现(linker command failed wit

作者: 青梅煮码 | 来源:发表于2017-06-12 14:40 被阅读540次

第三方库报错

开发中难免需要导入第三方库,导库之后编译报错:

Undefined symbols for architecture armv7:  
  "_OBJC_CLASS_$_MyPageLogViewController", referenced from:  
      objc-class-ref in BaiduMobStatAppDelegate.o  
ld: symbol(s) not found for architecture armv7  
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

解决方法是在Build settings->Linking->Other Linker Flags中添加-ObjC如图所示:

添加-ObjC

静态库报错

导入第三方静态库.a的时候,有的时候也会报错:

Undefined symbols for architecture armv7:  
  "_OBJC_CLASS_$_BaiduMobStat", referenced from:  
      objc-class-ref in libLECLivePlayerUISDK.o  
      objc-class-ref in libLECLivePlayerSDK.o  
ld: symbol(s) not found for architecture armv7  
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

这种情况下先看下是否是导入的库重复了,或者是没有引用,如果是导库冲突了,删除按照官方文档重新导入,如果是没有引用,在Build settings->Search Path->Library Search Paths中引入静态库路径,如图:

导入静态库路径

相关文章

网友评论

    本文标题:iOS中出现(linker command failed wit

    本文链接:https://www.haomeiwen.com/subject/fuulqxtx.html