Mach-O链接器错误 - 文件正确导入(并检查)但仍然出错?

时间:2014-11-23 10:52:53

标签: ios objective-c xcode compiler-errors linker-errors

我知道有无数的Mach-O Linker错误帖子,我已经查看了至少十几个试图找到我的问题的解决方案。许多解决方案评论说我必须“检查框”或检查编译源以确保我的.m文件已正确导入,是的,我做了所有这些。我已经在这几个小时,我似乎无法从下面的错误做任何事情:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_JSQMessage", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesAvatarImageFactory", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesBubbleImageFactory", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesTimestampFormatter", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesViewController", referenced from:
  _OBJC_CLASS_$_ChatView in ChatView.o
  "_OBJC_CLASS_$_JSQPhotoMediaItem", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQSystemSoundPlayer", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_METACLASS_$_JSQMessagesViewController", referenced from:
  _OBJC_METACLASS_$_ChatView in ChatView.o
  "_kJSQMessagesCollectionViewCellLabelHeightDefault", referenced from:
  -[ChatView collectionView:layout:heightForCellTopLabelAtIndexPath:] in ChatView.o
  -[ChatView collectionView:layout:heightForMessageBubbleTopLabelAtIndexPath:] in ChatView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

任何关于修复上述错误的帮助或建议都会得到很多赞赏,并最终允许我从这个扣人心弦的路障继续前进。提前谢谢!

2 个答案:

答案 0 :(得分:1)

通过Cocoapods使用此库时出现了同样的错误。执行pod install时发现此警告消息:

  

[!] Application [Debug]目标会覆盖OTHER_LDFLAGS   在“Pods / Target Support”中定义的构建设置   文件/荚/ Pods.debug.xcconfig”。这可能导致问题   CocoaPods安装

我在项目的构建设置中将$(inherited)添加到OTHER_LDFLAGS并修复了问题!

答案 1 :(得分:0)

您似乎错过了一个相关的框架'。文档是否指定了必需的框架。我猜它需要消息传递。