【问题标题】:Apple Mach-O Linker (id) Error - confused?Apple Mach-O 链接器 (id) 错误 - 困惑?
【发布时间】:2012-02-26 12:45:23
【问题描述】:

在我进行构建之前,我的项目没有错误。这是错误日志。

Ld "/Users/stephanieasan/Library/Developer/Xcode/DerivedData/WC_Class_Codes-fgxjeudpfimhnebtmvmxtzlirxnz/Build/Products/Debug-iphonesimulator/WC Class Codes.app/WC Class Codes" normal i386
cd "/Users/stephanieasan/Desktop/SDK Projects/WC Class Codes"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/stephanieasan/Library/Developer/Xcode/DerivedData/WC_Class_Codes-fgxjeudpfimhnebtmvmxtzlirxnz/Build/Products/Debug-iphonesimulator -F/Users/stephanieasan/Library/Developer/Xcode/DerivedData/WC_Class_Codes-fgxjeudpfimhnebtmvmxtzlirxnz/Build/Products/Debug-iphonesimulator -filelist "/Users/stephanieasan/Library/Developer/Xcode/DerivedData/WC_Class_Codes-fgxjeudpfimhnebtmvmxtzlirxnz/Build/Intermediates/WC Class Codes.build/Debug-iphonesimulator/WC Class Codes.build/Objects-normal/i386/WC Class Codes.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -framework iAd -lsqlite3.0 -framework UIKit -framework Foundation -framework CoreGraphics -o "/Users/stephanieasan/Library/Developer/Xcode/DerivedData/WC_Class_Codes-fgxjeudpfimhnebtmvmxtzlirxnz/Build/Products/Debug-iphonesimulator/WC Class Codes.app/WC Class Codes"

.

ld: duplicate symbol _OBJC_IVAR_$_ListTableViewController.DBPath in /Users/stephanieasan/Library/Developer/Xcode/DerivedData/WC_Class_Codes-fgxjeudpfimhnebtmvmxtzlirxnz/Build/Intermediates/WC Class Codes.build/Debug-iphonesimulator/WC Class Codes.build/Objects-normal/i386/Code.o and /Users/stephanieasan/Library/Developer/Xcode/DerivedData/WC_Class_Codes-fgxjeudpfimhnebtmvmxtzlirxnz/Build/Intermediates/WC Class Codes.build/Debug-iphonesimulator/WC Class Codes.build/Objects-normal/i386/ListTableViewController.o for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

我很困惑,我已经尝试调试了几个小时没有成功。

【问题讨论】:

  • 我能从中收集到的唯一信息是,您的项目中有一个重复的 ListTableViewController 定义。如果没有有关您的项目的更多详细信息,很难确切地说出原因。产生相同错误的最小示例会有所帮助。
  • 您是否有一个名为 DBPath 的全局变量,可能定义在名为“Code”的类以及名为“ListTableViewController”的类中?每个类都可能自己编译,但是当您尝试将它们链接到同一个可执行文件时,您会遇到冲突。

标签: objective-c ios xcode linker-errors mach-o


【解决方案1】:

Code.m,你不小心说了这样的话:

#import "ListTableViewController.m"

你的意思是这样说的:

#import "ListTableViewController.h"

【讨论】:

  • 你在 20 分钟内救了我两次!这困扰了我很长时间!
  • 继续问容易的,我会继续救你的。 ;)
  • 在整个项目中搜索 .m 文件只需搜索 .m" 并使用 .h 更改该文件
【解决方案2】:

或者您尝试导入的类具有相似的类名。

【讨论】:

  • 请提供更多关于您的假设的信息。
  • 我暂时遇到了这个错误并搜索了解决方案,直到我看到这篇文章,但我看到我导入了正确的类。然后我注意到我试图导入的新创建的类已经由我的同事在某个文件夹下创建。当我删除我所做的那个时,错误就消失了。
猜你喜欢
  • 2011-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-06
  • 1970-01-01
  • 2014-04-06
相关资源
最近更新 更多