Apple Mach-O Linker错误(“重复符号") [英] Apple Mach-O Linker error ("duplicate symbol")

查看:64
本文介绍了Apple Mach-O Linker错误(“重复符号")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译我的游戏,但不应该出现一个错误.

I am trying to compile my game and an error that shouldn't be coming up is.

这些是我班级的文件:

Circle.h:

#import <UIKit/UIKit.h>

@interface Circle : NSObject
{

}
@property (readwrite, assign) CGPoint Center;
@property (readwrite, assign) float Radius;

+ (Circle *) CircleMakeFromCenter:(CGPoint)center radius:(float)radius;

@end

Circle.m:

#import "Circle.h"

@implementation Circle
@synthesize Center;
@synthesize Radius;

+ (Circle *) CircleMakeFromCenter:(CGPoint)center radius:(float)radius{
    Circle *c = [[Circle alloc] init];
    c.Center = center;
    c.Radius = radius;

    return c;
}

@end

显示半径是重复符号这是一个错误.

It is bring up an error saying that Radius is a duplicate symbol.

为什么会出现此错误?

推荐答案

在Objective-C中出现此类错误的最常见原因是,您不小心将其放入了一个文件中:

The most common reason for this sort of error in Objective-C is that you have put this in one of your files accidentally:

#import "Circle.m"

什么时候应该放置这个:

when you should have put this:

#import "Circle.h"

这篇关于Apple Mach-O Linker错误(“重复符号")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆