Mach-o-linker,重复错误?

时间:2014-04-27 10:16:27

标签: ios objective-c

一切都很好,直到我导入一个.m文件,然后我得到了apple-o-mach链接器错误,它与重复文件有关 - 这是错误信息。

   Ld /Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Products/Debug-iphonesimulator/Chess\ Timer.app/Chess\ Timer normal i386
cd "/Users/Wills/Desktop/XCode projects/Chess Timer"
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Products/Debug-iphonesimulator -F/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Products/Debug-iphonesimulator -filelist /Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess\ Timer.build/Debug-iphonesimulator/Chess\ Timer.build/Objects-normal/i386/Chess\ Timer.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework AudioToolbox -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess\ Timer.build/Debug-iphonesimulator/Chess\ Timer.build/Objects-normal/i386/Chess\ Timer_dependency_info.dat -o /Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Products/Debug-iphonesimulator/Chess\ Timer.app/Chess\ Timer

duplicate symbol _callGameBuffer in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _gameBufferReady in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._hours in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._minutes in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._secondsLeft in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._timeLeftstring in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._player2Button in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
 duplicate symbol _OBJC_IVAR_$_ViewController._player2Timer in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
 duplicate symbol _timeLeft in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _buffer1 in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
 duplicate symbol _alerted in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._timeToShow in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
 duplicate symbol _OBJC_IVAR_$_ViewController._timeToShowString in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _timeLeft2 in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._player1Timer in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _buffer2 in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController.player2Timer in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController.player1Timer in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._callGameReadyBuffer in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._gameBufferReady in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._buffer1 in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._buffer2 in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._timeLeft in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._timeLeft2 in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._alerted in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._player1Button in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_IVAR_$_ViewController._playButton in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_CLASS_$_ViewController in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
duplicate symbol _OBJC_METACLASS_$_ViewController in:
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/ViewController.o
/Users/Wills/Library/Developer/Xcode/DerivedData/Chess_Timer-cfqcwankpfmmxwheqgqaivhnjtzf/Build/Intermediates/Chess Timer.build/Debug-iphonesimulator/Chess Timer.build/Objects-normal/i386/SettingsViewController.o
ld: 29 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我知道" Apple-O-Mach-Linker"错误,已经,但没有一个真正解释为什么这个错误发生,你怎么能以一般化的方式修复它,所以这次我不仅可以修复它,而且每次发生错误时都要修复它。非常感谢。遗嘱

1 个答案:

答案 0 :(得分:0)

导入意味着导入的文本文件必须先复制到目标文件中,然后再传递给编译器,它就像一个宏,宏就是那个文件中的宏。所以现在您正在为编译器提供源文件的内容以进行两次编译。 .h文件可以导入,因为我们只将声明放入.h文件中,并将定义放入.m文件中,只要你只有一个定义,就可以多次声明某些内容。例如,您可以在.h文件中声明ac函数,因此实际上它已声明多个位置,其中导入或包含.h文件,但该函数只能在一个.m或.c文件中定义。