Objective-c is a nice object-oriented language. However, mac book is not cheap for most of us. I decides to learn the language on ubuntu first. To compile objective-c, you should install the following tools and use gcc to compile it as follows.
gcc gobjc gnustep-devel
#import<Foundation/Foundation.h>
int main(int argc, char *argv[]){
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Hello World!");
[ pool drain];
return 0;
}
|
gcc hello.m `gnustep-config --objc-flags` -lgnustep-base -o hello
阅读(2047) | 评论(0) | 转发(0) |