8 Replies Latest reply: Dec 26, 2012 6:46 AM by etresoft
ajzpop Level 1 Level 1 (0 points)

Does Xcode support the development of GUI with c++? I have been able to develop console c++ program but I can't find any info on c++ GUI. Surely Xcode is up to the task.

  • 1. Re: Xcode c++ GUI
    g_wolfman Level 4 Level 4 (1,120 points)

    You can develop C++ GUI applications on OS X using Xcode.  But Apple's Developer Tools don't include any C++ UI libraries, so you'll have to choose a set of libraries for GUI development.

     

    Qt is a popular one (mainly because it's also supposed to be cross-platform).  It also has its own IDE, Qt Creator, and its own build system.  And it's massively bloated (because it does everything, not just GUIs).

     

    There's also WxWidgets, which is also fairly popular...and no two widgets have a consistent interface, so there's a moderate learning curve (and frustration).  Most other GUI libraries have similar design issues.

     

    GUI development on C++ has never been particularly well sorted out.  If you are developing for OS X only, you are probably best off learning Objective-C for the GUI, even if the rest of the code is in C++.

  • 2. Re: Xcode c++ GUI
    ajzpop Level 1 Level 1 (0 points)

    I certainly don't have a problem learning objective-c for the GUI but my classes right now are pushing c++ and I really like Xcode. Is qt free? Where can I get some info on cui building for c++. I am not having much luck with my searches. All of my searches are turning up stuff that is really old and I know things have progressed since 2008. Thanks for your help and merry Christmas!

  • 3. Re: Xcode c++ GUI
    etresoft Level 7 Level 7 (24,270 points)

    QT is free, but ugly. It would be a waste of time to learn that if you like Xcode and want to write Mac or iOS software. C++ is good for school because it is very difficult and that will help you learn to program. You will then find it much easier to work in a real, practical language. Don't waste any time with user interfaces in C++. You will never do that in school anyway.

  • 4. Re: Xcode c++ GUI
    g_wolfman Level 4 Level 4 (1,120 points)

    In general, GUI development is platform specific (Cocoa for OS X,.Net for Windows, GTK+ for Linux). 

     

    If your classes are doing GUI development, you should use whatever they are.  If they are using Windows, then you need to use whatever tools and libraries they are using.  If they aren't doing GUI development, then do whatever you like - but remember that GUI development is generally platform specific.

     

    The exception to that generality is cross-platform suites like Qt (which isn't really completely cross-platform).  But, like Java, that portability comes at the cost of having a massive infrastructure and unique build system.  There's nothing wrong with wanting to learn and develop in it...just don't do it by ignoring your classes.

     

    Qt does have a free open-source licensed version.  You can look into it more on the Qt-project site:

     

    https://qt-project.org

  • 5. Re: Xcode c++ GUI
    ajzpop Level 1 Level 1 (0 points)

    Well what language are most programs written in? Does it really boil down to .net and objective-c?

  • 6. Re: Xcode c++ GUI
    g_wolfman Level 4 Level 4 (1,120 points)

    Programs are written in almost any language you can imagine.

     

    GUIs are written (generally) in the native framework for the platform.  That means:

     

    OS X = Cocoa (Objective-C)

    Windows = .Net (C#)

    Linux = GTK+ (Tcl/Tk)

     

    Now, that's an oversimplification, of course (for example, OS X can run programs written in Tcl/Tk, especially using the X11 environment), but not much of one.  If a complex program is well engineered, its core will be written to be independent from any GUI layer.  So you may find a platform independent core, written in C++ or Python or Perl or C or just about anything, with different UI layers swapped in depending on the platform.

     

    That's what different language bindings are for.

  • 7. Re: Xcode c++ GUI
    ajzpop Level 1 Level 1 (0 points)

    That kinda sounds like what any program should be....portable with generic functions that can be used in many different programs.  I will start researching language bindings.  Thanks for the help!!!!

  • 8. Re: Xcode c++ GUI
    etresoft Level 7 Level 7 (24,270 points)

    That's all well and good. What g_wolfman has described is an "ideal". You will virtually never see such a thing. By that I don't mean "they aren't common" - I mean "they don't exist".

     

    If you want to write Mac or iOS software, you need to learn Objective-C - especially for the user interface portion. There is flat-out no other option. There are some low-level libraries that are supposed to be independent of any user interface and anything high-level like Objective-C. In these areas, C++ can be helpful if used judiciously.