Developing for OS X and Windows?

Discussion in 'Mac Programming' started by ogee, Mar 31, 2007.

  1. ogee macrumors 6502

    Nov 8, 2006
    If I create an application using Cocoa and Xcode on my Mac, can I also generate a windows exe from the same code?

    i.e. Is cross platform development feasible in this environment?

    I use Mac at home, but work is Windows only. I have a couple of windows app I wrote for XP and have to rewrite and I would love to do it on my mac and cross compile. One is a time management utility for shift workers, the other is a specialised utility to check satellite parameters and calculate various factors.
  2. Soulstorm macrumors 68000


    Feb 1, 2005
    Cocoa applications cannot be ported directly on PC's. Unfortunately, you must write some platform specific code in order for it to work.

    My advice is try to keep the important program functions cross-platform. That way, the only thing that will change during the porting process is the GUI code.

    However, you should try GNUSTEP. I haven't used it, but it seems it has some similar functions with Cocoa.
  3. grabberslasher macrumors 6502

    Aug 2, 2002
    You can compile Windows applications with the command line by installing MinGW:

    However, I cannot suggest an easy way to use it with Xcode, I personally use makefiles in my crosscompiling Xcode projects when I want to target Windows, Linux or iPod Linux.
  4. cblackburn macrumors regular

    Jul 5, 2005
    London, UK

    If you are developing cross platform from the outset, rather than porting a previous program then I would reccomend using a cross platform toolkit rather then Cocoa.

    You can co down the Java route but I personally hate the language and no matter what anyone says it will never be as fast at a natively compiled language.

    There is also a cross platform GUI toolkit called wxWidgets ( This will let you recompile your program onto Windows, MacOS X and Linux with little or no reworking required. It also runs on a variety of languages like C++ and Perl and many more.

  5. tutubibi macrumors 6502a


    Sep 18, 2003
    Another vote for wxWidgets.

    However, there are other options like QT that is very mature framework supporting Windows, OS X and Linux (KDE is written on top of QT). Another alternative is GTK (OSX project is hosted on sourceforge page but not really updated recently). For simpler apps, maybe even Tck/Tk is an option.

    And as previous posters already mentioned, there is Java too.

    Depending on the requirements you may also consider web-based application.
  6. caveman_uk Guest


    Feb 17, 2003
    Hitchin, Herts, UK
    QT is nice but it's not fact it's rather expensive if you're not doing open-source work. Check the licensing terms before you start using it.
  7. findhornriver macrumors newbie

    Oct 1, 2006
    wxPython is the easiest cross platform language/framework you'll find. It runs on Mac OSX (Universal), Linux and Windows and is very mature.

    Because its framework is wxWidgets (built in to wxPython by the way - you don't need to load wxwidgets) the look and feel of the application is native to the paltform it is run on.

    It'll make an app for osx and an exe for windows using py2app and py2exe so the end-user doesn't even need to have loaded python or anything else. It just runs.

    It's free, so give it a try.
  8. ogee thread starter macrumors 6502

    Nov 8, 2006
    Thanks that gives me a few ideas to look into.

    Any idea how companies like Adobe work on such projects, e.g. CS3 etc. I would assume they use a common code base?
  9. Aniej macrumors 68000


    Oct 17, 2006
    what languages are most commonly used for creating web based applications? Even though they are web based, would I still need to take into account cross-platform issues? I would assume yes to some degree for the same reason that safari does not work with certain features on some sites.
  10. ATG macrumors regular

    Aug 7, 2005
    Adobe use QT and C++ if I am not mistaken.

Share This Page