Mobile Application Development 2
Exercise: Hello World
Please create a new Objective-C project that prints "Hello World" to the console.
- Open the terminal and navigate to your projects folder
- Create a new file called
main.m
- Write the following code into the file using your favorite text editor:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
NSLog(@"Hello World");
return 0;
}
- Save the file and compile the project using the following command:
bash
clang -fobjc-arc main.m -o main
- Run the compiled program using the following command:
bash
./main