苹果O-math链接错误

创建了一个名为ObjCWorkAppMath.mNSObject文件。包含了一些函数在里面,我想在ViewController使用这个类,的那是编译失败返回了错误:

duplicate symbol _OBJC_METACLASS_$_ObjCWorkAppMath in:
    /Users/ctkt/Library/Developer/Xcode/DerivedData/ObjCWorkApp-hgxcjtjhzwxhqxcmxgkpucpfpieq/Build/Intermediates/ObjCWorkApp.build/Debug-iphonesimulator/ObjCWorkApp.build/Objects-normal/i386/ObjCWorkAppMath.o
    /Users/ctkt/Library/Developer/Xcode/DerivedData/ObjCWorkApp-hgxcjtjhzwxhqxcmxgkpucpfpieq/Build/Intermediates/ObjCWorkApp.build/Debug-iphonesimulator/ObjCWorkApp.build/Objects-normal/i386/ObjCWorkAppViewController.o
duplicate symbol _OBJC_CLASS_$_ObjCWorkAppMath in:
    /Users/ctkt/Library/Developer/Xcode/DerivedData/ObjCWorkApp-hgxcjtjhzwxhqxcmxgkpucpfpieq/Build/Intermediates/ObjCWorkApp.build/Debug-iphonesimulator/ObjCWorkApp.build/Objects-normal/i386/ObjCWorkAppMath.o
    /Users/ctkt/Library/Developer/Xcode/DerivedData/ObjCWorkApp-hgxcjtjhzwxhqxcmxgkpucpfpieq/Build/Intermediates/ObjCWorkApp.build/Debug-iphonesimulator/ObjCWorkApp.build/Objects-normal/i386/ObjCWorkAppViewController.o
ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

试了很多方法也没解决,请高手帮帮忙,多谢多谢。

#import "ObjCWorkAppViewController.h"
#import "ObjCWorkAppMath.m"

@interface ObjCWorkAppViewController ()

@end

@implementation ObjCWorkAppViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

你的项目多加了一个.m文件

ObjCWorkAppMath ObjCWorkAppViewController 里的重引用解决下就好了