If you come from a C, C++ and Java programming background then you won’t have any problems understanding the Objective C language. Below is a simple code that will display “Hello, World!” string.
#import <stdio.h>
int main(void)
{
printf("Hello, World!\n");
return 0;
}
Save this file as hello.m not hello.c, the next thing you will need to do is create a make file for your project.
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = HelloTest
HelloTest_OBJC_FILES = hello.m
include $(GNUSTEP_MAKEFILES)/tool.make
Save this file as GNUmakefile in the same project folder.
To build your project you need to go to your command prompt enter make and press enter to continue. Make sure you are in the project folder.
To run the executable all you have to do is enter this on your command line: ./obj/HelloTest
Hope this is simple and informative. Please let me know if it doesn’t work for you.
Download the source code:
HelloWorld.tar