The Cave

26 Dec

Objective-C Command Line Program

Simplest Objective-C program (for Mac):

#import

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

NSObject *object = [[NSObject alloc] init];
NSLog(@"Created Object: %@", object);

[pool release];
return 0;
}

and how to compile it:

gcc main.m -o main -ObjC -framework Foundation

The -framework parameter is the obscure part.

FacebookGoogle GmailGoogle BookmarksTechnorati FavoritesTwitterHotmailYahoo MailYahoo MessengerWordPressStumbleUponRedditEmailInstapaperGoogle+Share

Comments are closed.

© 2014 The Cave | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo