Compile error: "multiple methods named '-initWithSize:' found"
Compile error: "multiple methods named '-initWithSize:' found"
- Subject: Compile error: "multiple methods named '-initWithSize:' found"
- From: Julian Wood <email@hidden>
- Date: Wed, 9 Dec 2009 00:24:21 -0700
Hi,
I've been following this tutorial:
http://www.otierney.net/objective-c.html#subinheritance
which had been going well until I got to inheritance. When compiling that example, one gets a strange error that I would not have expected:
main.m: In function 'main':
main.m:7: warning: multiple methods named '-initWithSize:' found
/System/Library/Frameworks/AppKit.framework/Headers/NSImage.h:81: warning: using '-(id)initWithSize:(NSSize)aSize'
Square.h:4: warning: also found '-(Square *)initWithSize:(int)s'
main.m:7: error: incompatible type for argument 1 of 'initWithSize:'
Why would those two methods clash? NSImage is not even included. Moreover, aren't we saying specifically to use initWithSize from Square? And finally, why does it think we are not using an int as a param?
Simply changing the method name to initWithASize makes everything happy, but I feel I am missing something critical.
Can anyone explain this error? And a better way to avoid collisions of this type in the future?
Thanks,
Julian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden