Apple mach-o链接(Id)错误

时间:2012-03-11 14:14:51

标签: iphone objective-c xcode

我添加了所有相关框架,并导入了所有相关文件。事实上,如果我删除导入,它给了我所有方法未找到错误。任何想法如何解决这个问题?

Ld /Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator/Journal.app/Journal normal i386
    cd "/Users/Andrew/Dropbox/Developer/Dear Me/Version 1.0/XCode/Journal/Journal"
    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.1.sdk -L/Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator -F/Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator -filelist /Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Intermediates/Journal.build/Debug-iphonesimulator/Journal.build/Objects-normal/i386/Journal.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator/Journal.app/Journal

Undefined symbols for architecture i386:
  "_rectForRectWithInset", referenced from:
      -[JButton drawRect:] in JButton.o
  "_createRoundedRectForRect", referenced from:
      -[JButton drawRect:] in JButton.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

编辑:

从这些代码行中:

CGRect borderRect = rectForRectWithInset(self.bounds, 0.5);
CGMutablePathRef borderPath = createRoundedRectForRect(borderRect, 4);

他们用这些方法引用一个类。它在另一个项目中工作,具有相同的导入,相同的引用方法,相同的导入框架。

1 个答案:

答案 0 :(得分:3)

链接器错误很可能表示您错过了在目标的构建阶段中包含框架。

我不知道上述函数的实现,但我想,你错过了包含CoreGraphics或QuartzCore。你需要导入主头文件。