I'm new to Objective-C. I'm currently testing properties with the following code. Note this is on windows using GNUstep:
#import <Foundation/Foundation.h>
@interface Car : NSObject
@property NSString *color;
@end
@implementation Car
@end
int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Car *honda = [[Car alloc] init];
honda.color = @"Red";
NSLog(@"%s", honda.color);
[pool drain];
return 0;
}
But getting the following:
C:\Users\Bab\Desktop\main.m:5:2: warning: object property 'color' has no 'assign', 'retain' or 'copy' attribute; assuming 'assign' [enabled by default]
C:\Users\Bab\Desktop\main.m:5:2: note: 'assign' can be unsafe for Objective-C objects; please state explicitly if you need it
C:\Users\Bab\Desktop\main.m:9:1: warning: incomplete implementation of class 'Car' [enabled by default]
C:\Users\Bab\Desktop\main.m:9:1: warning: method definition for '-setColor:' not found [enabled by default]
C:\Users\Bab\Desktop\main.m:9:1: warning: method definition for '-color' not found [enabled by default]
: Uncaught exception NSInvalidArgumentException, reason: Car(instance) does not recognize setColor:
[Finished in 0.4s with exit code 1]