iOS - 架构i386的3个重复符号

时间:2013-11-12 23:01:28

标签: ios xcode duplicates linker-errors

我遇到了解链接器命令错误的问题。我收到以下信息:

duplicate symbol _OBJC_IVAR_$_XYZAddToDoItemViewController._toDoItem in:
/Users/*/Library/Developer/Xcode/DerivedData/ToDoToday-fjyijxlbvauebmeuhtgdvdrjtfez/Build/Intermediates/ToDoToday.build/Debug-iphonesimulator/ToDoToday.build/Objects-normal/i386/XYZToDoListViewController.o
/Users/*/Library/Developer/Xcode/DerivedData/ToDoToday-fjyijxlbvauebmeuhtgdvdrjtfez/Build/Intermediates/ToDoToday.build/Debug-iphonesimulator/ToDoToday.build/Objects-normal/i386/XYZAddToDoItemViewController.o
duplicate symbol _OBJC_CLASS_$_XYZAddToDoItemViewController in:
/Users/*/Library/Developer/Xcode/DerivedData/ToDoToday-fjyijxlbvauebmeuhtgdvdrjtfez/Build/Intermediates/ToDoToday.build/Debug-iphonesimulator/ToDoToday.build/Objects-normal/i386/XYZToDoListViewController.o
/Users/*/Library/Developer/Xcode/DerivedData/ToDoToday-fjyijxlbvauebmeuhtgdvdrjtfez/Build/Intermediates/ToDoToday.build/Debug-iphonesimulator/ToDoToday.build/Objects-normal/i386/XYZAddToDoItemViewController.o
duplicate symbol _OBJC_METACLASS_$_XYZAddToDoItemViewController in:
/Users/*/Library/Developer/Xcode/DerivedData/ToDoToday-fjyijxlbvauebmeuhtgdvdrjtfez/Build/Intermediates/ToDoToday.build/Debug-iphonesimulator/ToDoToday.build/Objects-normal/i386/XYZToDoListViewController.o
/Users/*/Library/Developer/Xcode/DerivedData/ToDoToday-fjyijxlbvauebmeuhtgdvdrjtfez/Build/Intermediates/ToDoToday.build/Debug-iphonesimulator/ToDoToday.build/Objects-normal/i386/XYZAddToDoItemViewController.o
ld: 3 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我不确定Xcode指的是哪些符号。以下是实现文件的顶部。

XYZToDoListViewController.m:

#import "XYZAddToDoItemViewController.h"
@interface XYZAddToDoItemViewController ()
@property NSMutableArray *toDoItems;
@end
@implementation XYZAddToDoItemViewController

XYZAddToDoItemViewController.m:

#import "XYZAddToDoItemViewController.h"
@interface XYZAddToDoItemViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *doneButton;
@end
@implementation XYZAddToDoItemViewController

非常感谢任何帮助,谢谢。

2 个答案:

答案 0 :(得分:2)

XYZToDoListViewController.m更改:

@interface XYZAddToDoItemViewController ()

为:

@interface XYZToDoListViewController ()

@implementation XYZAddToDoItemViewController

为:

@implementation XYZToDoListViewController

#import "XYZAddToDoItemViewController.h"

为:

#import "XYZToDoListViewController.h"

基本上,XYZToDoListViewController.m文件中的类名错误。

让你在XYZToDoListViewController.h文件中没有同样的错误。

答案 1 :(得分:0)

我在B.m

中导入A.m时遇到此错误

确保只导入.h文件