redeclared as different kind of symbol ,undefined reference to `__objc_class_name_Rectangle12'

本文详细解析了Objective-C中类名重复导致的错误,并解释了分类(Category)机制如何允许向现有类添加新方法而不修改源代码。通过实例展示了如何避免类名冲突并利用分类机制进行代码扩展。
||=== RTest, Debug ===|
D:\workspace\IOS\RTest\main.m|3|error: 'Rectangle' redeclared as different kind of symbol|
d:\app\ios\gnustep\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\wingdi.h|2956|error: previous declaration of 'Rectangle'|
D:\workspace\IOS\RTest\main.m|16|error: 'Rectangle' redeclared as different kind of symbol|
d:\app\ios\gnustep\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\wingdi.h|2956|error: previous declaration of 'Rectangle'|
D:\workspace\IOS\RTest\main.m||In function 'main':|
D:\workspace\IOS\RTest\main.m|41|error: 'myRect' undeclared (first use in this function)|
D:\workspace\IOS\RTest\main.m|41|note: each undeclared identifier is reported only once for each function it appears in|
D:\workspace\IOS\RTest\main.m|41|warning: invalid receiver type '' [enabled by default]|
D:\workspace\IOS\RTest\main.m|41|error: cannot convert to a pointer type|

||=== Build finished: 7 errors, 1 warnings ===|


类名重复,如果自己写的类名没有重复,则可能是根系统函数冲突.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

obj\Debug\main.o:main.m:(.data+0xb4)||undefined reference to `__objc_class_name_Rectangle12'|

错将Rectangle12.m引入成了Rectangle12.h


接口和实现类分

好像OBJ-C里的实现好像不跟JAVA一样,是单实现的,因为不可以给实现类写名字(或许是我没有发现).


其实也不算,这里面可以@interface A:NSObject

@interface B:A

@implementation B

{

//code here

}


@interface C:A

@implementation C

{

}

@interface D:B

@implementation D

{

}

------------------------------------------------------------------------------------------

ok,这好像是所谓的分类(categroy)机制

允许以模块方式向现有类定义添加新方法,也就是,不必经常给同一接口和实现文件增加新定义.当想要对你没有源代码访问权限的类添加新定义时,这特别方便.(分类和协议)

xcode手动导入包报错:Undefined symbol: _APMAnalyticsConfiguration Undefined symbol: _APMAppMeasurementOriginFirebase Undefined symbol: _APMConsentSettings3P Undefined symbol: _APMFormattedEventName Undefined symbol: _APMFormattedUserPropertyName Undefined symbol: _APMIsAnalyticsCollectionDeactivated Undefined symbol: _APMIsAnalyticsCollectionEnabled Undefined symbol: _APMIsValidTransactionDeviceVerification Undefined symbol: _APMMonitorLogTagOptionKey Undefined symbol: _APMUserDataFieldEmailAddress Undefined symbol: _APMUserDataFieldHashedEmailAddress Undefined symbol: _APMUserDataFieldHashedPhoneNumber Undefined symbol: _APMUserDataFieldPhoneNumber Undefined symbol: _OBJC_CLASS_$_APMAdExposureReporter Undefined symbol: _OBJC_CLASS_$_APMAnalytics Undefined symbol: _OBJC_CLASS_$_APMConditionalUserProperty Undefined symbol: _OBJC_CLASS_$_APMConditionalUserPropertyController Undefined symbol: _OBJC_CLASS_$_APMEvent Undefined symbol: _OBJC_CLASS_$_APMIdentifiers Undefined symbol: _OBJC_CLASS_$_APMIdentity Undefined symbol: _OBJC_CLASS_$_APMMeasurement Undefined symbol: _OBJC_CLASS_$_APMScreenViewReporter Undefined symbol: _OBJC_CLASS_$_APMUserAttribute Undefined symbol: _OBJC_CLASS_$_APMValue Undefined symbol: _OBJC_CLASS_$_MTGAdChoicesView Undefined symbol: _OBJC_CLASS_$_MTGBannerAdView Undefined symbol: _OBJC_CLASS_$_MTGBidNativeAdManager Undefined symbol: _OBJC_CLASS_$_MTGBidRewardAdManager Undefined symbol: _OBJC_CLASS_$_MTGBiddingSDK Undefined symbol: _OBJC_CLASS_$_MTGMediaView Undefined symbol: _OBJC_CLASS_$_MTGNewInterstitialAdManager Undefined symbol: _OBJC_CLASS_$_MTGNewInterstitialBidAdManager Undefined symbol: _OBJC_CLASS_$_MTGRewardAdManager Undefined symbol: _OBJC_CLASS_$_MTGSDK Undefined symbol: _OBJC_CLASS_$_MTGSplashAD Undefined symbol: _OBJC_METACLASS_$_APMAdExposureReporter Undefined symbol: _OBJC_METACLASS_$_APMConditionalUserProperty Undefined symbol: _OBJC_METACLASS_$_APMConditionalUserPropertyController Undefined symbol: _OBJC_METACLASS_$_APMEvent Undefined symbol: _OBJC_METACLASS_$_APMIdentifiers Undefined symbol: _OBJC_METACLASS_$_APMMeasurement Undefined symbol: _OBJC_METACLASS_$_APMScreenViewReporter Undefined symbol: _OBJC_METACLASS_$_APMUserAttribute Undefined symbol: _OBJC_METACLASS_$_APMValue
最新发布
07-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值