1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Objective C on PC :O

Discussion in 'Mac Programming' started by SRossi, Jul 29, 2009.

  1. macrumors regular

    Hi all,

    Since I just have a mac mini and its a few months till i qualify for educational discounts again I would like to know how to program Objective C on the PC.

    I have looked into it a bit and was pointed in the direction of GNUstep, which I downloaded with the GNUcore.

    But what I found was that its a bit annoying compiling it in the shell and was wondering if there was a GUI development tool to download to compile Objective C code. I am not wanting it to act like interface builder because I can simply wait and design the interface on my mini.

    Even if it was an add on for another GUI compiler on the PC (I have visual studio + Dev-C++) so if there was any add ons that people have used would also help me a lot.


    Stephen :)
  2. macrumors 6502a

    Objective-c yes, Cocoa, kind of.

    Like you have already found out, GCC supports objective c, however it does not yet support Objective-c 2.0(with automatic GC among other things). GNUStep is an attempt to implement all the Cocoa features with GCC, but be warned it's pretty far behind where Apple is(and is going)

    Keep in mind that if you want to test your code on the mac, you are going to have to make sure to tell gcc to make Mach binaries as they are probably(unless you are using Darwin :p) not the default executable type on your machine.

    Ultimately, you really should consider using the mac mini for development. It can run all the fun tools, will definitely produce mac binaries, and is guaranteed to have all the features you need.
  3. Guest

    As stated previously, the Mini is more than adequate for Objective C development. (My first Mini, a single core model, was purchased for development.)

    Unless you are just experimenting, you will likely be disappointed by the Objective C tools offered on Windows. Cygwin and Minwin are good places to start. While I have used gcc on both Cygwin and Minwin (including compiling objective c files), I did not try to integrate it into Visual Studio. If you happen to figure out how to do it, you should write it up and post it somewhere for the next person!
  4. macrumors regular

    Having a little look around on the web and having a look at dev c++ website I have found out that it is actually built using the GCC compiler so therefore it SHOULD compile and run Objective-C code but not 2.0. Well not as far as I know, if someone could explain why I'm all ears because I thought that 2.0 was also built upon the GCC compiler.

    I'll let you know how I get on with Dev C++.

    Thanks for the tips soo far.


    EDIT: Right I have set up Dev C++ (beta version) and just trying a "Hello World" app and I am wondering how Dev C++ allows you to import other header files because I am trying to use the Foundation.h file located in the GNUstep files that I downloaded yesterday. Any help would be appreciated and im sure that other people will hopefully also be able to use this thread as well.
  5. macrumors regular

    including header files is a language function. It's not specific to an IDE. Put this at the top of your .c file

    #include "foundation.h"

    I suggest reading through either the gnustep docs or more appropriately, the official Objective-C Programming Guide on the Apple developer site.
  6. macrumors regular

    Yeah I understand how to include a file into it but what I am meaning is that the files are held else where and when I include them I am getting a compile error that they cannot be found. I have added the folder where they are contained into the Compile Options -> Directory and copied it into the Binaries, Libraries, C and C++ subfolders.

    Ill try again today to get it working though :).


    EDIT: Also Dev C++ also will not save the file as a .m file, this may also be the case as in why it wont find the included file, would saving it as .c make any difference?
  7. macrumors regular

    Hmm, Dev C++ is quite old. Does it have any support for Objective-C at all? I know theoretically it should work since it's the compiler that matters but you don't want the IDE fighting against you. Have you looked at Code::Blocks IDE? It appears to support ObjC.
  8. macrumors regular

    Theoretically it should, even says in the docs that it will work but contradicts its self but saying not supported.

    Yeah I had looked a little into Code::Blocks but I thought it looked absolutely cluttered, there was too many things happening at once, but I am thinking that it could be the only way unless using MinGW, which is a pain to install (I've tried and failed a few times now).

    Thinking the best to do is us VIM to create the file then just use the GNUstep shell to compile it, but I absolutely hate using Command Prompt or shells on Windows.

    Tomorrow I'm going to look into which packages can be downloaded for Visual Studio, because im sure I read somewhere that Objective-C was included in a package which made it completely supported.

    I'll keep trying anyway, thanks for everyones help but I've not finished yet more help would be great :)

  9. macrumors 65816


    GNUStep been around longer then cocoa, GNUStep is GNU version of openstep, which is based on NeXTstep. Cocoa is Apple modified modernised version of NeXTstep.

    you could say GNUStep is the sibling of Cocoa, and that NeXTstep is the parent.

Share This Page