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

||=== 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)机制

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


---------------------------------------------------------------------------------------------------------------------------------
copyright:http://www.cnblogs.com/anee/
原文地址:https://www.cnblogs.com/anee/p/2675886.html