2012-03-11 87 views
1

我添加了所有相關的框架,並導入了所有相關的文件。事實上,如果我刪除導入,它會給我所有的方法找不到錯誤。任何想法如何解決這一問題?Apple mach-o鏈接(Id)錯誤

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); 

他們引用了一類在這些方法中它可以在另一個項目中,我有,用相同的進口,是相同的。引用的方法,相同的導入框架。

+0

你能向我們展示產生這些錯誤的兩行代碼嗎?另外,你添加了什麼框架? – 2012-03-11 15:04:51

+1

用該信息編輯。 – Andrew 2012-03-11 17:01:27

+0

我無法在Apple框架中找到這些方法。你知道他們應該在什麼框架嗎?在QuartzCore/CoreGraphics中有相當的(如下面答案的評論中所提到的),所以我建議使用這些。 – 2012-03-12 12:16:19

回答

3

鏈接器錯誤最有可能表明您錯過了在您的目標的構建階段中包含框架。

我不知道提到的功能的實現,但我認爲,你錯過了包括CoreGraphics或QuartzCore。你需要導入主頭文件。

+0

不,這些功能都不在任何Apple框架中。 (雖然有等價的是'CGRectInset()'和'+ [UIBezierPath bezierPathWithRoundedRect:cornerRadius:]'。) – 2012-03-11 17:45:08

+0

@KurtRevis:但它們可能依賴於框架 – vikingosegundo 2012-03-11 17:50:57