运行Objective C代码时出现奇怪错误

时间:2012-06-14 18:18:12

标签: objective-c compiler-errors

我的项目没有可见的错误,但是当我尝试运行它时会出现以下错误

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ConcreteScreen", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我在ViewController.m中使用我的ContactScreen类

我试过@class ContactScree和#import "ContactScreen.h"

在我的ViewController中,我将其用作[ContactScreen myMethod]; 当我注释掉这一行它工作正常,但现在它给编译时错误:( 昨天它很好吗

这是我的代码

#import "ViewController.h"


#import "ConcreteScreen.h"
@interface ViewController ()

@end

@implementation ViewController




-(IBAction)btnContactPress:(id)sender{
   NSLog(@"Contact Screen");

    ConcreteScreen *coontact = [[ConcreteScreen alloc]init];

}

2 个答案:

答案 0 :(得分:2)

您混淆了ConcreteScreenContactScreen,编译器告诉您它不了解ConcreteScreen

答案 1 :(得分:1)

确保您的.m文件包含在项目中。可以创建它,使用标题和所有,但它不会进入构建。它也需要在目标中。

相关问题