TextWrangler Demo

Discussion in 'Mac Programming' started by hassoon, Feb 6, 2012.

  1. hassoon, Feb 6, 2012
    Last edited: Feb 6, 2012

    hassoon macrumors regular

    Jun 8, 2009
    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.
  2. robvas macrumors 68030

    Mar 29, 2009
    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:


    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;

Share This Page