1.duplicate symbol _OBJC_CLASS 错误处理方法
背景:程序中出现类似下面的error:
duplicate symbol _OBJC_IVAR_$_HYCSipContentLength._length in:
/Users/admin/Library/Developer/Xcode/DerivedData/iPhoneCU-cvwemcuhhfyhmebotkjxhhuqyhoz/Build/Intermediates/iPhoneCU.build/Debug-iphonesimulator/iPhoneCU.build/Objects-normal/i386/HYCSipContentLength.o
/Users/admin/Library/Developer/Xcode/DerivedData/iPhoneCU-cvwemcuhhfyhmebotkjxhhuqyhoz/Build/Intermediates/iPhoneCU.build/Debug-iphonesimulator/iPhoneCU.build/Objects-normal/i386/HYCSipResponse.o
重复引用,意思就是有两次或多次使用HYCSipContentLength类,找了半天也没找出来。后来网上看到一篇文章:
出处:http://akuyie.diandian.com/post/2012-03-08/14236752
错误:
ld: duplicate symbol _OBJC_CLASS_$_************ in ****************
一种可能性是你的项目的不同group里有着相同名称的类
**********************************************************
第二种就suck了:
You could also get this error if you mistakenly let XCode's auto-complete for #import statements specify the '.m" file for the 'duplicate' class instead of the '.h'.
************************************************************
xcode的自动完成特性,在你导入头文件的时候,将".h"补成了".m"
我使用全项目查找HYCSipContentLength终于发现在HYCSipResponse.h中#import "HYCSipContentLength.m"
噢。低级错误。。
其实通过我上面错误显示也能看出是在HYCSipResponse类中出现错误
2.duplicate symbol _OBJC_CLASS_$_PhotoInfo in:****/lib/libVYImKit.a(VYMessage.o)
ld: 16 duplicate symbols for architecture x86_64
方法一是:则是因为C++混编模式引起的,您可以将BuildSettings设置项里面的OtherLinkerFlags设置成空即可。参考:http://blog.csdn.net/bigpaolee/article/details/8911695。ios开发,一些注意项和常见错误
方法二:targets->Build Settings->Linking->Other Linker Flags:-ObjC,-all_load.
我使用第一种不行,方法二可以。
3.duplicate symbol __Z12propListenerPvjjPKv in:
xxxx/x86_64/RecorderManager.o
xxxx/IMSDK/lib/libVYImKit.a(UBIVoiceMsgEngine.o)
ld: 1 duplicate symbol for architecture x86_64
全局搜索到propListener发现在recorderManager.m中有这个方法,改成别的名称就ok了。因为它与libVyImKit中的方法重名。
网友评论