开发者

How to overcome Xcode 4 errors when learning Objective C by Kochan book

开发者 https://www.devze.com 2023-02-28 05:33 出处:网络
So, I\'m learning Objective C by this book. It is thought to be great and all. http://www.amazon.com/Programming-Objective-C-2-0-Stephen-Kochan/dp/0321566157/ref=sr_1_1?ie=UTF8&qid开发者_高级运维=

So, I'm learning Objective C by this book. It is thought to be great and all. http://www.amazon.com/Programming-Objective-C-2-0-Stephen-Kochan/dp/0321566157/ref=sr_1_1?ie=UTF8&qid开发者_高级运维=1303332025&sr=8-1

But after installing new Xcode (version 4) when i tried to finish the exercise form the book (3.2) it gives me like 10 compilation errors that I can't identify. What can I do about this? Getting xcode 3 is not really an option. For example there are many semantic errors that keep saying undeclared identifiers pointing to empty spaces...

also it isn't accepting this line of code:

Fraction *myFraction;

I got class myFraction, what's wrong with this one?

Also there is method declaration in this class

- (void) setNum : (int) n;

it says, expecting member name or ; after declaration specifiers. What can this mean? There already is a semicolon there.


Fraction *myFraction;

I got class myFraction, what's wrong with this one?

In this statement, Fraction is the name of your class... myFraction is the name of your object. If your class is really called myFraction, this statement would be:

myFraction *myFraction;

Also there is method declaration in this class

- (void) setNum : (int) n;

it says, expecting member name or ; after declaration specifiers. What can this mean? There already is a semicolon there.

I don't see anything wrong with this... can you post the code that surrounds this method declaration?

0

精彩评论

暂无评论...
验证码 换一张
取 消