小编cms*_*cms的帖子

未定义的符号:"_ OBJC_CLASS_ $ error

我一直在查看有关此错误的无数帖子:

Undefined symbols:
"_OBJC_CLASS_$_BoxView", referenced from:
  objc-class-ref-to-BoxView in ViewMovingViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

BoxView是一个子类UIView,并且UIKit框架已包含在内.BoxView.h已在ViewController中导入.

ViewController包含以下代码:

-(void) addBoxViewAtLocation:(CGPoint)point {
    CGRect rect;  
    rect.origin.x = point.x;  
    rect.origin.y = point.y;  
    rect.size.width = 80;  
    rect.size.width = 40;  
    BoxView *newView = [[BoxView alloc] initWithFrame:rect];  
    newView.backgroundColor = [UIColor yellowColor];  
    [mainView addSubview:newView];  
}  
Run Code Online (Sandbox Code Playgroud)

BoxView包含此代码:

- (id)initWithFrame:(CGRect)frame {     
    self = [super initWithFrame:frame];  
    if (self) {  
        // no further initialization  
    }  
    return self; 
}  
Run Code Online (Sandbox Code Playgroud)

这是导致错误的行,来自上面的代码: …

xcode linker objective-c ios

24
推荐指数
1
解决办法
3万
查看次数

标签 统计

ios ×1

linker ×1

objective-c ×1

xcode ×1