简体   繁体   English

Xcode中的Mach-O链接器错误

[英]Mach-O Linker Error in Xcode

Ok so I have 2 projects. 好的,我有2个项目。 I want to import a class file from Project 1 to Project 2. When I import the class file. 我想将项目1中的类文件导入到Project 2.当我导入类文件时。 I get a linker error. 我收到链接器错误。 Here's what it looks like. 这是它的样子。

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

How do I fix this? 我该如何解决?

Your tags include both ios and osx. 您的标签包括ios和osx。 if you're building an iOS app, check your Architecture setting in your Xcode project. 如果您正在构建iOS应用程序,请检查Xcode项目中的架构设置。 It shouldn't be x86_64. 它不应该是x86_64。

Possibly, you might have forget adding target to that file. 可能,您可能忘记将目标添加到该文件。 In Xcode, Select the .m file and In the 'File inspector' on the right pane check Target Membership. 在Xcode中,选择.m文件,然后在右侧窗格的“文件检查器”中,选中Target Membership。 Ensure that the target is checked for this file. 确保检查此文件的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM