Dvole
Dvole

Reputation: 5795

@property failing, what's wrong?

So, I have a class called Stone. In Stone.h i have those lines:

@interface stone : CCNode <CCTargetedTouchDelegate> {
GameLayer *theGame;
}
@property(readwrite,nonatomic, retain) GameLayer *theGame;
@property(readwrite,nonatomic,retain) CCSprite *mySprite;

and my Stone.m

@implementation Stone

@synthesize theGame,mySprite;

This is all relevant code. But the compiler says - no declaration of property theGame and mySprite found in the interface. And to make it worse this is a book example, what am I doing wrong? I checked code it is exactly the same as in book.

Why is it not seeing the declaration of properties in .h file? #import statement is there. I thought it was pointer issue, but it is not seeing properties for pure ints too - @property(readwrite, assign) int stoneType; for example returns same error.

Upvotes: 0

Views: 112

Answers (3)

max_
max_

Reputation: 24481

Change 'stone' here:

@interface stone : CCNode <CCTargetedTouchDelegate> {
GameLayer *theGame;
}
@property(readwrite,nonatomic, retain) GameLayer *theGame;
@property(readwrite,nonatomic,retain) CCSprite *mySprite;

To Stone:

@interface Stone : CCNode <CCTargetedTouchDelegate> {
    GameLayer *theGame;
    }
    @property(readwrite,nonatomic, retain) GameLayer *theGame;
    @property(readwrite,nonatomic,retain) CCSprite *mySprite;

Upvotes: 4

InsertWittyName
InsertWittyName

Reputation: 3940

Lowercase 'stone' in your @interface, uppercase 'Stone' in your @implementation.

Upvotes: 9

tamasgal
tamasgal

Reputation: 26259

First you should write Stone (uppercase) after Interface.

Second, there is no variable "mySprite" in your interface.

Upvotes: 0

Related Questions