C++ GUI For Mac

Discussion in 'Mac Programming' started by Supershane457, Aug 5, 2010.

  1. Supershane457 macrumors newbie

    Joined:
    Aug 5, 2010
    #1
    Hi. I've been using C++ for awhile. And I just got a new Mac. I know Xcode is very nice but I still prefer C++ to Cocoa and Carbon. So I was wondering are there any good C++ GUIs for a mac?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Cocoa and Carbon are libraries, not languages so your question is a bit nonsensical: you can access Cocoa via Objective-C++ from C++ and/or Carbon from C++ (as Carbon is pure procedural C). If you want a pure C++ library you will have to look at non-Apple GUI toolkits which will result in apps that do not feel 100% platform native.
     
  3. Supershane457 thread starter macrumors newbie

    Joined:
    Aug 5, 2010
    #3
    Sorry I meant the Objective-C language. Xcode is foreign to me with all the different libraries and files. But do you know if Qt would be good? I'm looking into that now.
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    If you don't particularly care about it feeling like a real Mac app I'm sure it'll be fine.
     
  5. Supershane457 thread starter macrumors newbie

    Joined:
    Aug 5, 2010
    #5
    Thank you. I don't really mind. I was only looking for a cross platform GUI. But if you knew of any way to integrate C++ into an Xcode Project that would also be nice.:)
     
  6. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #6
    Create a new Objective-C++ project and you should be good to go. Use the Objective-C Mac libraries to do the UI stuff and have that code call your existing C++ code. It will all integrate together. I haven't personally done this, but I see the options to create Objective-C++ projects in XCode.
     
  7. ShortCutMan macrumors member

    Joined:
    Aug 8, 2005
    #7
    Qt should be fine, and is quite easy to get into. I use it at work, however, that is developing for the Windows platform; I haven't used it for OS X. But don't be discourage by Cocoa and its use of Objective-C! Take up the challenge and learn it, I'm sure you'll be pleasantly surprised! :)
     
  8. pinsrw macrumors regular

    Joined:
    May 30, 2010
    #8
    The major options are all not very good: Qt, GTK+ and WxWidgets, I have found, are all buggy due to their being huge projects with months-long backlogs of bug reports that no one is paid for fix. Very few programmers who do widget sets have stuck to the maxim of small, modular coding projects; almost everything is bloated junk.
     
  9. cube macrumors G5

    Joined:
    May 10, 2004
    #9
    What are you talking about? Trolltech developed Qt and it is now owned by Nokia.

    Of course there are people paid to work on it. And it works well.
     
  10. elppa macrumors 68040

    elppa

    Joined:
    Nov 26, 2003
    #10
    You can still write all the logic, non GUI code in C++.

    But if you get to grips with how outlets and bindings work then if it is a small app it may not be that much work to get a far better result out the other end on the Mac.

    Maybe I'm being unkind, but I think it might be time to bite the bullet and try something new. Cross platform GUIs are always a not very good compromise.
     
  11. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #11
    elppa's suggestion is really the right one. If you intend to write applications on MacOS X that are even close to feeling like MacOS X applications then you need to code the GUI's with the AppKit (Cocoa) Framework. Anything else is going to feel alien, and MacOS X users are sensitive to that[1].

    You can still build all of of your logic in C++, but you need to have clean separation of your program logic and the presentation system. If you are doing it right you already have this, and this division should be easy.

    My interpretation of Supershane457's objections boil down to his/her being used to one way of doing things (some C++ library) and reacting negatively to a new way doing things (AppKit/Cocoa). If you are going to work on MacOS X, then you are going to have to get used to the way of doing things here. Swimming up-stream is not going to be very productive.

    [1] They are not the only ones, look at the gnashing of teeth on Windows over iTunes and QuickTime which feel non-native there.
     
  12. TennisandMusic

    Joined:
    Aug 26, 2008
    #12
    I think it's more to do with the fact that the programs are absolutely terrible on Windows, not how they look. Plenty of different looking things on Windows, and the users generally deal.
     
  13. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #13
    It's unfortunate that Apple has given up on Carbon. From a few recent explorations into Carbon it appears that most of the procedural APIs are actually implemented in C++ privately (e.g. HIObjectRef, HIView, etc). Would have been nice if they supported that layer officially.

    Semi-OT: to those who are doing cross-platform UIs on Mac and Windows, what do you use for Windows? MFC?
     
  14. pinsrw macrumors regular

    Joined:
    May 30, 2010
    #14
    I tried their OpenGL Hello world program, and guess what happened? The OpenGL subwindow, which was supposed to be confined with the area of its widget, instead appeared outside of the main window. I ran the code a few times and it appeared a different spot on the display every time. I've got no time to wait for Nokia to fix such basic bugs.
     
  15. pinsrw macrumors regular

    Joined:
    May 30, 2010
    #15
    They may have given up on it, but I can still compile and run Carbon code.
     
  16. Supershane457 thread starter macrumors newbie

    Joined:
    Aug 5, 2010
    #16
    Sorry I couldn't reply for several days. I've been a little busy. But thank you for all of your suggestions. I decided to take on the challenge of learning objective-c and I'm still very new to it but it works well :)
     

Share This Page