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.

  • Facebook
  • Google Gmail
  • Google Bookmarks
  • Technorati Favorites
  • Twitter
  • Hotmail
  • Windows Live Favorites
  • Yahoo Mail
  • Yahoo Messenger
  • WordPress
  • StumbleUpon
  • Reddit
  • Share/Bookmark

Comments are closed.

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

GPS Reviews and news from GPS Gazettewordpress logo