问题描述
我有一个问题了解链接器命令错误。我收到以下内容:
I am having an issue understanding a linker command error. I am receiving the following:
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正是指哪些符号。以下是实施文件的顶部。
I'm not sure which symbols Xcode is referring to exactly. Below are the top of the implementation files.
XYZToDoListViewController.m:
XYZToDoListViewController.m:
#import "XYZAddToDoItemViewController.h"
@interface XYZAddToDoItemViewController ()
@property NSMutableArray *toDoItems;
@end
@implementation XYZAddToDoItemViewController
XYZAddToDoItemViewController.m:
XYZAddToDoItemViewController.m:
#import "XYZAddToDoItemViewController.h"
@interface XYZAddToDoItemViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *doneButton;
@end
@implementation XYZAddToDoItemViewController
任何帮助将不胜感激,谢谢您。
Any help would be much appreciated, thank you.
推荐答案
在您的 XYZToDoListViewController.m
更改:
@interface XYZAddToDoItemViewController ()
to:
@interface XYZToDoListViewController ()
和:
@implementation XYZAddToDoItemViewController
to:
@implementation XYZToDoListViewController
和:
#import "XYZAddToDoItemViewController.h"
to:
#import "XYZToDoListViewController.h"
基本上你在 XYZToDoListViewController.m
文件中有错误的类名。
Basically you have the wrong class name in the XYZToDoListViewController.m
file.
让你不要在 XYZToDoListViewController.h
文件中也有同样的错误。
Make you don't have the same mistake in the XYZToDoListViewController.h
file.
这篇关于iOS - 架构i386的3个重复符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!