PDA

View Full Version : TextWrangler Demo




hassoon
Feb 6, 2012, 12:00 PM
can any one show me how to write the "Hello World" program on textWrangler and running it using the terminal with the objective-c language? i know that i can use xcode and stuff but i just wanna learn how to use TextWrangler. Thank you in advance.
P.S: if you can provide a step-by-step i'll be more than thankful.



robvas
Feb 6, 2012, 12:25 PM
Edit your file in TextWranger (name it hello.m). Open up a Terminal, and go to the directory that you saved the file in, and enter the following commands:

gcc -framework Foundation hello.m -o hello

Then, to run the program enter the following command:

./hello

You can use the following code for this example, save it as hello.m

#import <Foundation/Foundation.h>

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

NSLog(@"Hello world\n");

[pool drain];
return 0;
}