Apple Mach-O-Linker(ID)错误 [英] Apple Mach-O-Linker (ID) Error

查看:53
本文介绍了Apple Mach-O-Linker(ID)错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我正在处理的项目中添加了一个名为RootViewController的现有类.该项目是第一次编译,但是第二次我尝试运行它时,出现了mach-o-linker错误.我没有更改任何代码来实现这一点,所以我真的不知道出什么问题了.我知道此错误通常是由于缺少框架引起的,但是我敢肯定我已经包含了我需要的所有框架.

I added an existing class called RootViewController to my project I am working on now. The project compiled the first time, but the second time I tried to run it the mach-o-linker error popped up. I didn't change any code for that to happen, so I don't really know what's wrong. I know this error is usually because of a missing framework, but I'm pretty sure I included all the frameworks I need.

这是日志:

Ld /Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator/coredataproject.app/coredataproject normal i386
cd /Users/myusername/Desktop/coredataproject
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator -F/Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator -filelist /Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Intermediates/coredataproject.build/Debug-iphonesimulator/coredataproject.build/Objects-normal/i386/coredataproject.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -framework CoreLocation -framework MapKit -o /Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator/coredataproject.app/coredataproject

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

我已经搜索了几个小时,试图找到丢失的链接或参考,但是我没有发现任何错误.任何帮助将不胜感激.

I have searched around for hours try to find a missing link or reference, but I don't see anything wrong. Any help would be greatly appreciated.

推荐答案

我刚刚修复了它.我从RootViewController中复制了代码,完全删除了.h和.m文件,创建了新文件,并将名称更改为RootViewController并将代码粘贴回了.然后进行编译.

I just fixed it. I copied the code out of RootViewController, deleted the .h and .m files entirely, created new files and changed the name to RootViewController and pasted the code back in. It then compiled.

这篇关于Apple Mach-O-Linker(ID)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆