I get this error in the first NSLog command of the main :
Here is the complete code :
Rectangle.h :
Code:
//
// Rectangle.h
// rectangleProject
//
// 12/14/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Rectangle : NSObject
{
int width;
int height;
}
@property int width, height;
-(int) area;
-(int) perimeter;
-(void) setWidth: (int) w andHeight: (int) h;
@end
Rectangle.m :
Code:
//
// Rectangle.m
// rectangleProject
//
// 12/14/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "Rectangle.h"
@implementation Rectangle
@synthesize width, height;
-(void) setWidth:(int) w andHeight: (int) h
{
width = w;
height = h;
}
-(int) area
{
return width * height;
}
-(int) perimeter
{
return (width + height) * 2;
}
@end
rectangleProject.m :
Code:
#import "Rectangle.h"
#import <stdio.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
Rectangle *myRect = [[Rectangle alloc] init];
[myRect setWidth:5 andHeight:8];
NSLog("w = %i, h = %i", myRect.width, myRect.height);
NSLog(@"Area = %i, Perimeter = %i", [myRect area], [myRect perimeter]);
[myRect release];
[pool drain];
return 0;
}
Any ideas?
Thank you.