CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Thread: GUI's in C++?

  1. #1
    Join Date
    Jun 2009
    Posts
    100

    GUI's in C++?

    I am really at a loss here.

    I have gotten a decent grip on C++ with terminal based programs but how can I make a GUI?

    Is there any good GUI programming in C++ tutorials out there?

    Dont forget that I am using Linux with GCC. I know there is a huge difference in the way they handle windows and GUI's.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: GUI's in C++?

    There are several options. GTK+, WxWidgets, and QT are the most common cross-platform GUI frameworks. They all follow similar paradigms.

  3. #3
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: GUI's in C++?

    You could consider using a GUI framework, e.g., FLTK, FOX Toolkit, gtkmm, Qt, wxWidgets (and the list goes on).
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  4. #4
    Join Date
    Dec 2008
    Posts
    10

    Re: GUI's in C++?

    This is a bit off topic, but a lot of folks are doing GUI stuff in a high level language as a wrapper around fast C/C++ code. If you are familiar with one of the various scripting languages that have good support for C/C++ calls, that might prove to be a faster way.

  5. #5
    Join Date
    Jun 2009
    Posts
    100

    Re: GUI's in C++?

    Ok I found out that no matter what I do there is no easy way to compile windows programs with linux gcc.

    Is there a GUI kit JUST for linux?

    The ones listed above are for both but I would have to recompile the code to make it work on windows anyways so I think that since I am not going to use the windows option I should choose an GUI kit that is just for linux to save download bandwidth and HDD space.

  6. #6
    Join Date
    Dec 2008
    Posts
    10

    Re: GUI's in C++?

    Most of those are just source based, so...you won't be wasting disk space, except for a few macro defintions and specialized classes/functions. GTK is gnome took kit, I think. It was ported over to windows just to let windows users use the programs.

  7. #7
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: GUI's in C++?

    Quote Originally Posted by e_torstenson
    GTK is gnome took kit, I think.
    GIMP Tool Kit. gtkmm is the official C++ wrapper for GTK+.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  8. #8
    Join Date
    Nov 2006
    Posts
    1,611

    Re: GUI's in C++?

    You really should consider more than just the target of Linux.

    The quality and support of a framework is at least as important. Consider how much time you'll spend learning any framework (a few months), and ask yourself would you choose to invest that time limited to one OS? Why not invest that time in a framework such that, in the future, you'd be familiar with it on several potential target OS, including Mac?

    Qt is recognizably a superior design than many of the other frameworks, and it offers a lot more than just GUI. It works on Linux as well as any other, and the time spent learning it would apply to any target in the future.

    That's not the case with GTK+. It may be fairly well designed, but there's a lot more energy in documentation for Qt, and it's design goes well beyond what GTK+ provides. The GTK port for Windows is not exactly stellar.

    It's true that you should compile Windows programs on Windows, Mac programs on a Mac - that's simply logical. If you develop with something that's portable anyway, you loose virtually nothing, and gain the ability to be flexible.

    I've not been a particular fan of Qt, but it is seriously good work and produces good to excellent results on all target platforms, and that's tough to say about any of the other frameworks (there are no perfect ones).
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  9. #9
    Join Date
    Dec 2008
    Posts
    10

    Re: GUI's in C++?

    I can say from personal experience that wxWindows is easy to use for small jobs, but it becomes pretty cumbersome as the project gets bigger. The design very outdated, which is unfortunate. It does work natively on each of the separate platforms-which can't be said of GTK-but I ran into a few gotchas when testing it in windows (which I think is where wxWidgets development is generally done...) A coworker highly recommended QT. If I do another complex GUI, it will either be QT based, or I'll use something higher level and interface to my C++ code.

  10. #10
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: GUI's in C++?

    Quote Originally Posted by e_torstenson View Post
    It does work natively on each of the separate platforms-which can't be said of GTK
    Aside from requiring X11 on OSX, are there any other places GTK is non-native?

  11. #11
    Join Date
    Dec 2008
    Posts
    10

    Re: GUI's in C++?

    Quote Originally Posted by Lindley View Post
    Aside from requiring X11 on OSX, are there any other places GTK is non-native?
    I doubt it, but I really don't know. The X11 isn't a huge issue, but it's worth keeping in mind if you plan to target OSX.

  12. #12
    Join Date
    Jan 2009
    Posts
    1,689

    Re: GUI's in C++?

    I would recommend wxWidgets. This gives you an interface that works with Windows, X11, Aqua, GTK...

  13. #13
    Join Date
    Nov 2006
    Posts
    1,611

    Re: GUI's in C++?

    wxWidgets was used for the GUI interface for AVG antivirus and FileZilla (I mention those two because you can download them for free to see what the results are like).

    The only "gotcha" on Mac targets for wxWidgets is that it uses Carbon as the underlying API. That limits the target to 32bits only, and some of the "exclusive" OSX features aren't automatically supported.

    Qt moved the Mac implementation to Cocoa on the Mac, which allows for 64 bit Mac targets and OSX feature support.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  14. #14
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: GUI's in C++?

    WxWidgets also has a Cocoa backend, but it's still experimental at this point.

  15. #15
    Join Date
    Nov 2006
    Posts
    1,611

    Re: GUI's in C++?

    The first Cocoa attempts for wxWidgets go back to 2001. It's been in "alpha" ever since.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured