Duplicate Symbols causing Apple Mach-O Linker Error

时间:2015-07-28 17:02:00

标签: ios objective-c

I am receiving the following error when building my project.

duplicate symbol _OBJC_CLASS_$_PrintAdventureMenuViewController in:
/Users/ethanraymond/Library/Developer/Xcode/DerivedData/jake-and-bailey-fbutnsfforlfnpgkxyojdsdcaobc/Build/Intermediates/jake-and-bailey.build/Debug-iphonesimulator/jake-and-bailey.build/Objects-normal/i386/PrintAdventureMenuViewController.o
/Users/ethanraymond/Library/Developer/Xcode/DerivedData/jake-and-bailey-fbutnsfforlfnpgkxyojdsdcaobc/Build/Intermediates/jake-and-bailey.build/Debug-iphonesimulator/jake-and-bailey.build/Objects-normal/i386/AdventureTypeMenuViewController.o

duplicate symbol _OBJC_METACLASS_$_PrintAdventureMenuViewController in:
/Users/ethanraymond/Library/Developer/Xcode/DerivedData/jake-and-bailey-fbutnsfforlfnpgkxyojdsdcaobc/Build/Intermediates/jake-and-bailey.build/Debug-iphonesimulator/jake-and-bailey.build/Objects-normal/i386/PrintAdventureMenuViewController.o
/Users/ethanraymond/Library/Developer/Xcode/DerivedData/jake-and-bailey-fbutnsfforlfnpgkxyojdsdcaobc/Build/Intermediates/jake-and-bailey.build/Debug-iphonesimulator/jake-and-bailey.build/Objects-normal/i386/AdventureTypeMenuViewController.o

ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This was just after creating "PrintAdventureMenuViewController" class. So it is currently empty. "AdventureTypeMenuViewController" is not empty. It is populated with views other code.

1 个答案:

答案 0 :(得分:0)

我的问题是在AdventureTypeMenuViewController.m文件中我使用了import语句......

#import "PrintAdventureMenuViewController.m"

而不是......

#import "PrintAdventureMenuViewController.h"