我在Xcode的项目中遇到错误。我一直在取得良好的进展,到目前为止,一切都进展顺利。在对我的应用程序中的一个页面进行一些微妙的布局更改后,在尝试运行它时 - 我得到一个mach-o链接器错误,说明多个(266!)重复的符号。
到目前为止,我有:
我在这个和其他网站上看了很多类似的帖子,到目前为止,大多数错误似乎都是人们导入实现文件时的错误。当我过去遇到类似的错误时,通过代码来解决它们相当容易 - 通常它是不同类中的重复变量。这一次,我尽力将事情尽可能地封装起来,到目前为止我还没有在这个项目中遇到过这个问题。
我现在就在这里发布错误信息。该代码现已发布在https://github.com/bentaylor42/iRSI的GitHub上,因为它太长而无法放在此页面上。
Ld /Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Products/Debug-iphonesimulator/irsi.app/irsi normal i386
cd "/Users/bentaylor/Dropbox/iRSI v2/irsi"
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/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Products/Debug-iphonesimulator -F/Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Products/Debug-iphonesimulator -filelist /Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Intermediates/irsi.build/Debug-iphonesimulator/irsi.build/Objects-normal/i386/irsi.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 AVFoundation -framework QuartzCore -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Intermediates/irsi.build/Debug-iphonesimulator/irsi.build/Objects-normal/i386/irsi_dependency_info.dat -o /Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Products/Debug-iphonesimulator/irsi.app/irsi
duplicate symbol _OBJC_IVAR_$_MainMenuViewController._labelVersion in:
/Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Intermediates/irsi.build/Debug-iphonesimulator/irsi.build/Objects-normal/i386/MainMenuViewController-9C9455DB49A1DC98.o
duplicate symbol _OBJC_IVAR_$_MainMenuViewController._labelCopyright in:
/Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Intermediates/irsi.build/Debug-iphonesimulator/irsi.build/Objects-normal/i386/MainMenuViewController-9C9455DB49A1DC98.o
duplicate symbol _OBJC_IVAR_$_MainMenuViewController._switchPHEM in:
/Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Intermediates/irsi.build/Debug-iphonesimulator/irsi.build/Objects-normal/i386/MainMenuViewController-9C9455DB49A1DC98.o
duplicate symbol _OBJC_IVAR_$_MainMenuViewController._labelPHEM in:
/Users/bentaylor/Library/Developer/Xcode/DerivedData/irsi-acrjzbjeyiktwpglrdrfvwhlnhql/Build/Intermediates/irsi.build/Debug-iphonesimulator/irsi.build/Objects-normal/i386/MainMenuViewController-9C9455DB49A1DC98.o
//... and so on, for 266 duplicated symbols, across multiple classes throughout the app)
ld: 266 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
答案 0 :(得分:1)
您在Compile Sources中有许多重复的.m文件,将它们从名为" irsi"的目标中删除,之后,您应该成功编译。
顺便说一下,我认为你也应该从你的项目中删除重复的引用,我在下面的图片中列出了一些。