; color:rgb(54,46,43); font-family:Arial,Console,Verdana,‘Courier New‘">
像这样的一大堆,总体说编译链接时错误
/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator/ClothingOrders.app/ClothingOrders normal i386
cd /Users/zhangtianjian/Desktop/SVN
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
setenv 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/iPhoneSimulator6.1.sdk -L/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator
-L/Users/zhangtianjian/Desktop/SVN/ZBarSDK -F/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator -filelist /Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/ClothingOrders.LinkFileList
-Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -lz -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework CoreData -liconv -framework QuartzCore -framework
CoreVideo -framework CoreMedia -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -lzbar -o /Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator/ClothingOrders.app/ClothingOrders
duplicate symbol _OBJC_METACLASS_$_EntityOrdersTotal in:
/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/EntityOrdersTotal-1502FC93349A1D59.o
duplicate symbol _OBJC_CLASS_$_EntityOrdersTotal in:
/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/EntityOrdersTotal-1502FC93349A1D59.o
ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ios开发这个错误一定少不了,现总结如下,一般这三方面的问题,如果不是哪你真可麻烦了
1.引用出错,把***.h弄成了.m,检查一下你的所有引用;
2.再就是你引用第三方的库,你添加文件是系统没有所第三方库的.m文件参入的编译中去,你向项目添加文件得注意了;
3.就是不小心添加的重复的类,向Entity之类,具体你可以看这里http://stackoverflow.com/questions/2264455/iphone-duplicate-symbol-error
顺便说一下http://stackoverflow.com/这个网站是iso开发不可少的一个网站;
4.有些frameworks没有添加进来也会出现上面的问题;
如果是新添加的第三方库,且不是静态库
先重复第一步过程,然后找到 Build settings->Linking->Other Linker Flags
将此属性修改成-all_load 或者 -ObjC ,这个视情况而定。总之可以多试几次。
3.如果添加的是第三方静态库(.a文件)
[html] view
plaincopy
- Undefined symbols for architecture armv7:
- "_OBJC_CLASS_$_BaiduMobStat", referenced from:
- objc-class-ref in BaiduMobStatAppDelegate.o
- objc-class-ref in MyPageLogViewController.o
- (maybe you meant: _OBJC_CLASS_$_BaiduMobStatAppDelegate)
- ld: symbol(s) not found for architecture armv7
- clang: error: linker command failed with exit code 1 (use -v to see invocation)
在用到这个库的所有文件中都出现了错误, 如上 BaiduMobStatAppDelegate 类和 MyPageLogViewController类
这种情况就可能是这个静态库路径混乱导致的链接错误
解决方法:Build settings->Search Path->Library Search Paths 添加静态库的相应路径。如下图
如果上面的所有方法都不管用。你可以再试试一下几个方法:
1,看看是不是有新添加的文件跟之前文件同名
2,错误信息中出现了某个类的名字,去原文件中看看#import了哪些第三方库,把这些库挨个注释排除,找到出错的那个库,然后按照官方提供的步骤重新添加一遍。
报这样的错误可能是同一个.m文件同时存在,要先把你新添加的.m文件彻底删除 Move to Trash 点击这个删除。然后clear一下,再在重新添加你所需要的文件即可解决。这次添加不要推进来,需要在你本地文件哪里进行添加,进行拷贝添加。不然可能还会冲突。