0

我正在开发简单的应用程序,并且在编写代码时没有错误,但是当我按下构建按钮时,发生了错误。构建 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(我知道这是错误的,但只是为了测试),项目将在模拟器中构建和工作。有人可以帮我吗?我做错了什么?

4

1 回答 1

3

AxesDrawer.m 可能不在您的目标中。单击它并使用最右边的实用程序面板,并确保它已检查您正在构建的目标。

于 2012-08-05T12:43:10.097 回答