Objective-C Jump Start

There are tons of great tutorials on the Internet that go into the details of the Objective-C.  I put this together to help others coming from another language like C++, C# or Java get a ten minute overview of the basic syntax and have some compilable self-contained code examples.  There is a brief comment at the top of each example indicating the "topic" that is demonstrated.  

Below are instructions on how to quickly compile and run them.


GNUstep on Windows
  1. Download and install the MSYS, Core and Devel packages (in that order) from this page: http://gnustep.org/experience/Windows.html 
  2. Click:   Start | All Programs | GNUstep | shell
  3. Type:  pwd   (you'll see something like this:  \home\xyz where xyz is your username)
  4. Then in windows explorer navigate to the path displayed above but stating at the drive you installed GNUstep on (something like: C:\GNUstep\home\xyz )
  5. Create a file named GNUmakefile  with the following contents:

    include $(GNUSTEP_MAKEFILES)/common.make
    TOOL_NAME = ex0
    ex0_OBJC_FILES = ex0.m
    include $(GNUSTEP_MAKEFILES)/tool.make

  6. Create a file named ex1.m in C:\GNUstep\home\xyz and copy and paste the code from the ex1.m page into the file. 
  7. At the GNUstep prompt type:   make
  8. Then type   ./obj/ex1   to run the sample


Xcode on the Mac
  1. Open Xcode
  2. Create a new xcode project.
  3. The new project window will give you the option of creating an Iphone app or Mac OS X app –we’re creating an Mac OSx app.
  4. Under “Mac OS X” your going to choose a “Command Line Tool” make sure you’re choose “Foundation” from the drop down.
  5. Create a name to Save your app (let’s assume you’ve chose the name app1). 
  6. Open the .m file. In this case the file would be called app1.m.
  7. Delete everything on the page and copy/paste in one of the examples. 


Subpages (5): ex0.m ex1.m ex2.m ex3.m ex4.m