我创建了一个名为“ObjCWorkAppMath.m”的 NSObject 文件,它包含一些有用的函数,我想在我的 ViewController 文件中使用该类,但 XCode 没有编译我的项目并返回以下错误:
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)
我尝试了stackoverflow中的所有解决方案来解决这个错误,但它仍然不起作用或者我做错了......
#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
错误在哪里?