There should be more than just that one line.

C requires that functions be declared before they are used; if they
are not, it assumes they take any number of parameters and return an
int.  At the points at which you call colorName, the compiler hasn't
seen a declaration for colorName yet, but can infer that it is a
function from the way you're using it.  So it assumes it's "int
colorName()" and continues on its merry way.  Then when it sees your
definition of colorName later on, it complains because the definition
"NSString *colorName(ShapeColor)" does not match the assumed "int
colorName()".

You have two options:

1. Provide a prototype of colorName somewhere before it is used.
Typically this is done in a header (.h) file which is #imported by the
source (.m) file.
2. Move the definition of colorName before it is used.

I also suggest you consult your favorite C language book for more.  I
have always been partial to K&R.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to