Xcode 退出代码 1 - 重复符号
抱歉,我知道这个问题已经被覆盖了,只是我无法解决这个问题以挽救我的生命。
如果有人能清楚地解释我可能做了什么以及我可以做些什么来解决这个问题,我将永远感激不已。
这是我的错误:
Command /Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
ld: duplicate symbol _OBJC_IVAR_$_sunnyHillsTL._tileMap in /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/libcocos2d libraries.a(sunnyHillsTL.o) and /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/sunnyHillsTL.o
Ld /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/workingTitle.app/workingTitle normal armv7
cd "/Users/kahanejosh/Documents/iPhone:Mac Dev/Working Title/workingTitle"
setenv IPHONEOS_DEPLOYMENT_TARGET 3.0
setenv PATH "/Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin:/Xcode 4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
"/Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2" -arch armv7 -isysroot "/Xcode 4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk" -L/Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos -F/Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos -filelist /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/workingTitle.LinkFileList -dead_strip -all_load -ObjC -miphoneos-version-min=3.0 -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework AudioToolbox -framework OpenAL -lz -framework AVFoundation "-lcocos2d libraries" -o /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/workingTitle.app/workingTitle
ld: duplicate symbol _OBJC_IVAR_$_sunnyHillsTL._tileMap in /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/libcocos2d libraries.a(sunnyHillsTL.o) and /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/sunnyHillsTL.o
collect2: ld returned 1 exit status
Command /Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Sorry I know this has been covered all over the place, only I can't fix this to save my life.
If someone could explain clearly what I might have done and what I might be able to do to fix this I would be forever grateful.
Here is my error:
Command /Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
ld: duplicate symbol _OBJC_IVAR_$_sunnyHillsTL._tileMap in /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/libcocos2d libraries.a(sunnyHillsTL.o) and /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/sunnyHillsTL.o
Ld /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/workingTitle.app/workingTitle normal armv7
cd "/Users/kahanejosh/Documents/iPhone:Mac Dev/Working Title/workingTitle"
setenv IPHONEOS_DEPLOYMENT_TARGET 3.0
setenv PATH "/Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin:/Xcode 4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
"/Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2" -arch armv7 -isysroot "/Xcode 4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk" -L/Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos -F/Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos -filelist /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/workingTitle.LinkFileList -dead_strip -all_load -ObjC -miphoneos-version-min=3.0 -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework AudioToolbox -framework OpenAL -lz -framework AVFoundation "-lcocos2d libraries" -o /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/workingTitle.app/workingTitle
ld: duplicate symbol _OBJC_IVAR_$_sunnyHillsTL._tileMap in /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/libcocos2d libraries.a(sunnyHillsTL.o) and /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/sunnyHillsTL.o
collect2: ld returned 1 exit status
Command /Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来您设置了两个目标,并且您的源代码正在这两个目标中使用。因此,您使用 sunnyHillsTL 类创建一个静态库,并将其放入 libcocoas2dlibraries.a 中,然后您也使用相同的目标文件。如果您正在使用该库,请不要直接在目标中使用该类(不要将该类添加到目标中),或者不要将该类编译为静态库的一部分。
It looks like you have two targets set up and your source is getting used in both. So, you create a static library with the sunnyHillsTL class that gets put into libcocoas2d libraries.a and then you are using the same object file as well. Either don't directly use the class in your target (don't add the class to the target) if you're using the library, or don't have this class be compiled as part of the static library.
似乎您的“sunnyHillsTL”类中有两个名为“tileMap”的实例变量...
Seems like you have two instance variables named «tileMap» in your «sunnyHillsTL» class...
从 Xcode 安装命令行工具。
在 Xcode 中 ->首选项->下载->组件 -> 命令行工具
install Command Line Tools from your Xcode.
in Xcode -> Preferences -> Downloads -> Components ->Command Line Tools