1

I want to start learning objective-c with book: Programming in Objective-C (4th Edition) . I working on Windows xp. To compile objective-c programs I install GNUstep and when I type this example what I found in some tutorial:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSLog (@"hello world");
    [pool drain];
    return 0;
}

Its all works fine. But when I try to type first example from this book:

#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
    NSLog (@"Programming is fun!");
}
return 0;
}

I get many errors:

What I get ib console

Do anyone know what I dooing wrong? Thanks for any help.

1
  • May this tutorial help!, it shows the required environment that should be set on Windows.
    – Malloc
    Aug 28, 2012 at 15:10

1 Answer 1

3

This is because @autoreleasepool is a new feature introduced with the LLVM compiler, so basically your compiler won't understand how to process this. When Apple introduced ARC, this was a required change in the language and so it's now the standard way of creating autorelease pools.

1
  • 1
    @klemens You should be able to, I don't know how to go about installing it though. Feb 24, 2012 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.