How to study objective C under windows

Screenshot of Cygwin

Image via Wikipedia

Objective C seems to gain popularity nowadays. My only exposure to this language is through random snippets I saw here and there, mostly written by friends of mine, chasing the dream of becoming the next iPhone millionaire. And I have to say: I find it ugly. I mean really really ugly!

People say though, that once you get used to it, it seems natural and it has advantages (read: late binding) that make it a powerful tool for creating applications.

Well, after all its just another programming language. So I thought I’d give it a try.Β  Preferably without owning a mac.

Here is how I did it:

  • Download cygwin – install it with the default settings.
  • That’s about it! Cygwin comes with an objective C compiler, so you are good to go once you install it.

How to write a first objective c test program:

#import <stdio.h>
int main(int argc, char *argv[]) {
    printf("Hello, from objC!\n"); 
}

Create a file named “hello.m” in your cygwin home directory containing the above code. Then open a cygwin prompt and write the command: gcc -o hello hello.m

And there you have it, a free development environment to try out the language. Your next step (pun intended) might be a good tutorial or a book describing the language. I suggest something that covers the language only, not the common APIs (GNUstep, Cocoa, whatever). If you think you can stand the language itself, you can then try to learn the APIs and create that iPhone app you were dreaming about!

Advertisements

9 thoughts on “How to study objective C under windows

  1. Indeed, the language is trully horrible syntax-wise. And I think it feels very fragile.

    I got a small book called “Objective C pocket reference” from o’reily just to get me started. It’s cheap, very short and to the point.

  2. Hey im a total newbie with programming but got lots of ideas for iphone games, im using windows vista and have been told i need to learn objective c. i tried installing gnustep as i was told i would need this to learn obj c code but had lots of problems. I have cygwin and have managed to install and run the hello example succesfully but im still a litle confused… is cygwin all i need to learn objective c code to start me off on my road to my own iphone game…
    thanks

    • Well, technically yes, having a programming environment should be enough to get you started learning the language. In your case though, I wouldn’t suggest that. Since you are a beginner there are lots of things you have to understand about game programming. Apart from programming itself there are graphics and sound etc. And in my opinion using a language like objective c is only going to be an obstacle in understanding the other stuff. If you really want to start learning how things work I would suggest a simpler programming language like C. On the other hand if what you want is to just quickly implement your ideas for iPhone, knowing the bare minimum of the technical stuff then start using an engine like unity 3d. It’s easy to learn, uses C# and javascript for scripting which are a lot easier than objective c and has everything ready for you to use. That should get you started quickly.

  3. hey thanks for the repley

    i will defos have a look at the site

    i dont suppose you know anything about gnustep? i was told you use gnustep as i would be able to practice objective c with that but i cant get it to open… searched everywhere but theres nothing ….

    thanks

  4. No I haven’t used GNUStep, actually I stopped trying to learn objective C myself. Seems to me like an unfinished language in which even the simplest task is a pain in the ass. If I ever make an iPhone game I’m going to just use objective C to wrap the underlying APIs and then use the wrapper with a real programming language πŸ™‚

  5. Your example was pure C, which of course compiles fine with gcc. Try to put in some Objective C code, and see what happens πŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s