Search code examples
objective-cmemory-managementcompiler-errorsautoreleasegnustep

Objective-C on GNUstep AutoReleasePool undeclared problem


I'm new to Objective-C and working in GNUstep and MinGW environment. I am compiling this code but having an error:

#import "Foundation/Foundation.h"

@interface C : NSObject
{
    float f;
}

- (void) gamerHell: (NSString *) name : (NSString *) lastName ;

@end

@implementation C

- (void) gamerHell: (NSString *) firstName : (NSString *) lastName {

    NSLog(@"Welcome, %s %s",firstName,lastName);
}

@end

int main(int argc , const char * argv[]){

    NSAutoReleasePool * pool = [[NSAutoReleasePool alloc] init];

    C *ob = [[C alloc] init];
    [ob gamerHell: @"SHAN" : @"UL HAQ"];

    [ob release];

    [pool drain];
    return 0;
}

It is giving a compile-time error like this:

'NSAutoReleasePool' is undeclared (first use in this function)

What should I do to overcome this error?


Solution

  • Try using NSAutoreleasePool instead of NSAutoReleasePool (with a lowercase r).