Why ObjC program getting stuck? I'm newbie in ObjC and trying to compile it on Linux system by command:
gcc $(gnustep-config --objc-flags) *.m $(gnustep-config --base-libs)
Here the code:
int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Rect * r = [[Rect alloc]initWithWidth:30 height:50];
NSLog(@"%f", [r height]);
[pool drain];
return 0;
}
//=====
#import <Foundation/Foundation.h>
@interface Rect : NSObject <NSCopying> {
}
@property double width;
@property double height;
- (Rect *) initWithWidth:(double)w
height:(double)h;
- (double) height;
//...
//=====
@implementation Rect
- (Rect *) initWithWidth:(double)w
height:(double)h
{
self.width = w;
self.height = h;
return [super init];
}
- (double) height
{
return self.height;
}
// ...