我正在做一个项目,当我构建项目时,我遇到了以下问题:
Ld /Users/KiKo-SaMa/Library/Developer/Xcode/DerivedData/SpaceInvaders-cgcsumybmrxbddfqdwhevdvubdic/Build/Products/Debug/SpaceInvaders.app/Contents/MacOS/SpaceInvaders normal x86_64
cd /Users/KiKo-SaMa/Desktop/SpaceInvaders
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/KiKo-SaMa/Library/Developer/Xcode/DerivedData/SpaceInvaders-cgcsumybmrxbddfqdwhevdvubdic/Build/Products/Debug -F/Users/KiKo-SaMa/Library/Developer/Xcode/DerivedData/SpaceInvaders-cgcsumybmrxbddfqdwhevdvubdic/Build/Products/Debug -filelist /Users/KiKo-SaMa/Library/Developer/Xcode/DerivedData/SpaceInvaders-cgcsumybmrxbddfqdwhevdvubdic/Build/Intermediates/SpaceInvaders.build/Debug/SpaceInvaders.build/Objects-normal/x86_64/SpaceInvaders.LinkFileList -mmacosx-version-min=10.6 -fobjc-arc -fobjc-link-runtime -framework Cocoa -o /Users/KiKo-SaMa/Library/Developer/Xcode/DerivedData/SpaceInvaders-cgcsumybmrxbddfqdwhevdvubdic/Build/Products/Debug/SpaceInvaders.app/Contents/MacOS/SpaceInvaders
duplicate symbol _Cycles in:
/Users/KiKo-SaMa/Library/Developer/Xcode/DerivedData/SpaceInvaders-cgcsumybmrxbddfqdwhevdvubdic/Build/Intermediates/SpaceInvaders.build/Debug/SpaceInvaders.build/Objects-normal/x86_64/emulator.o
/Users/KiKo-SaMa/Library/Developer/Xcode/DerivedData/SpaceInvaders-cgcsumybmrxbddfqdwhevdvubdic/Build/Intermediates/SpaceInvaders.build/Debug/SpaceInvaders.build/Objects-normal/x86_64/SpaceInvadersMachine.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
起初,我查看了这里的问题并试图理解错误消息,似乎我有一个重复的变量名,所以我更改了它,当我尝试再次构建它时,我一直收到同样的错误,我也检查了重复的函数名称,我的代码似乎没有任何问题。我还检查了包含,因为在一个问题中,其中一个解决方案是包含 .m 而不是 .h。有人可以帮我解决这个问题。
我不知道这是否相关,但起初我遇到了 3 个问题,似乎我必须在我的项目的“构建阶段”的“编译源”中添加两个 C 文件,现在我只有 1 个问题就是上面那个。
谢谢