我正在处理简单的应用程序,在编写代码时没有错误,但是当我按下构建按钮时,错误已经发生。构建myProject:失败,xCode显示两个错误警告。这里有错误信息:
Ld /Users/MacUser/Library/Developer/Xcode/DerivedData/Calculator-azorstixlscpikfhurtxwvvwachh/Build/Products/Debug-iphonesimulator/Calculator.app/Calculator normal i386
cd "/Users/MacUser/Downloads/Downloads/Desktop/old drop box/calc/Calculator"
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/MacUser/Library/Developer/Xcode/DerivedData/Calculator-azorstixlscpikfhurtxwvvwachh/Build/Products/Debug-iphonesimulator
-F/Users/MacUser/Library/Developer/Xcode/DerivedData/Calculator-azorstixlscpikfhurtxwvvwachh/Build/Products/Debug-iphonesimulator
-filelist /Users/MacUser/Library/Developer/Xcode/DerivedData/Calculator-azorstixlscpikfhurtxwvvwachh/Build/Intermediates/Calculator.build/Debug-iphonesimulator/Calculator.build/Objects-normal/i386/Calculator.LinkFileList
-mmacosx-version-min=10.6 -Xlinker
-objc_abi_version -Xlinker 2
-fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100
-framework UIKit -framework Foundation -framework CoreGraphics
-o /Users/MacUser/Library/Developer/Xcode/DerivedData/Calculator-azorstixlscpikfhurtxwvvwachh/Build/Products/Debug-iphonesimulator/Calculator.app/Calculator
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AxesDrawer", referenced from:
objc-class-ref in AxesView.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我找到了一些东西,这是我的controller.m代码:
#import "AxesView.h"
#import "AxesDrawer.h"
@implementation AxesView
- (void)drawRect:(CGRect)rect
{
CGRect b;
b = self.bounds;
CGPoint aO;
aO = b.origin;
CGFloat pPU;
pPU = b.size.height;
[AxesDrawer drawAxesInRect:(CGRect)b originAtPoint:(CGPoint)aO scale:(CGFloat)pPU];
}
@end
我认为在我的AxesDrawer.h文件中的问题,但我不知道为什么。如果我将AxesDrawer.h中的导入更改为AxesDrawer.m(我知道这是错误的,但仅用于测试) 该项目将在模拟器中构建和工作。有人可以帮我这个吗?我做错了什么?
答案 0 :(得分:3)
AxesDrawer.m可能不在您的目标中。单击它并使用最右侧的Utilities面板,确保检查您正在构建的目标。