GUI toolkit for C... which one?

This is a discussion on GUI toolkit for C... which one? within the C Programming forums, part of the General Programming Boards category; What is the easiest GUI toolkit for C programming? I've written a large amount of code for Linux that I ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    9

    GUI toolkit for C... which one?

    What is the easiest GUI toolkit for C programming? I've written a large amount of code for Linux that I need to add a GUI.

    I looked downloaded GTK but it looks like a steep learning curve. I've heard about QT but their website indicate liscensing fees. wxWidgets looks simple with good tutorials but apparently is for C++ which would be another learning curve.

    I'm serious about learning one of these but I can already see it will be a large investment of time. So which way should I go?

  2. #2
    Registered User
    Join Date
    Aug 2007
    Posts
    81
    I'd go with QT, its one of those things that remind you why you loved programming in the first place. There's no fees if you aren't writing commercial applications.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    9
    I looked into QT and unfortunately its based on C++. I'm not up to learning C++ at this point because I feel like my C programming is just now coming up to a good level. And I'm working on other things in Python.

    I found the best possible solution: Glade and libglade. Very easy to set up a GTK GUI with Glade. If anyone else is looking to add a GUI to their C code then I highly recommend Glade, especially for Linux.

    Thanks,
    JB

  4. #4
    Registered User
    Join Date
    Dec 2007
    Location
    Vancouver BC
    Posts
    4

    Same question for Windows

    I'm writing a C application, initially on WinXP, but likely will be moved to some flavor of Linux. It's written in C because it needs to be very fast - the application could take months to run. I'd like an elementary GUI for Windows to create how-goes-it information that is more elegent than a DOS window. I have Visual Studio 2005 (novice) but am afraid of all the other stuff that might get dragged into the code if I use their GUI capability.

    Any suggestions?

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,764
    Why would you want a GUI interface telling you the progress on a program which takes months to run?

    "Mmm, it's been at 1% all day, I wonder what that means".
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    6,531
    Salem makes a good point.

    Another point is that a program which runs for months does not need to be programmed in C to run fast. It is better to devote your attention to the algorithms employed in order to reduce computational demands, and to design the software in a way that ensures there is no resource leakage, which has a tendency to make programs slow down as they run for longer periods. If you don't consider such things, then choice of programming language will not make things better. It is just as easy (if not easier) to write an inefficient program in C as it is in any other language.

  7. #7
    Chinese pâté foxman's Avatar
    Join Date
    Jul 2007
    Location
    Canada
    Posts
    404
    Yeah, fancy GUI (or even not fancy one) aren't worth much for your problem. If you want to output some information about the state of your program, i would suggest you to use the console. That should be just good.

    And like grumpy said, if you want your program to run fast, try choosing the best possible algorithm. Nothing beat a good algorithm, except a better one. And if you did so and still want your program to be faster, well, you could try writing it in assembly, can make some significative difference if you are good at it.

  8. #8
    Registered User
    Join Date
    Dec 2007
    Location
    Vancouver BC
    Posts
    4

    All good comments

    All good comments. I've written a lot of assembly code; I've considered writing some of it in MASM. But in terms of tradeoffs, C seems optimial at first blush. I've done some simple tests in C vs. C# and between those it's no contest.

    My need for some form of primitive GUI comes from wanting to keep track of the behavior of the program over time in ways that aren't so well described in ASCII. It's an 'inference' model; I'm experimenting with new search algorithyms in an AI application, and it would be great to 'see' how the model reacts over time to its environment. I figured someone out there knew of a simple GUI that works well with C without undue overhead. Maybe there isn't such a thing. This forum has some really experienced members; I figured it couldn't hurt to ask.

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,764
    Well there's nothing stopping you writing the model in C (running as one thread), and the UI written in C++ (as another thread), which periodically snoops in on the progress and draws whatever you want.

    As for the "performance", you need to begin with generating some profile data to see where the hot-spots really are.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File IO with .Net SDK and platform SDK
    By AtomRiot in forum Windows Programming
    Replies: 5
    Last Post: 12-14-2004, 10:18 AM
  2. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 07:18 AM
  3. .NET And GUI Programming :: C++
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 01-27-2002, 04:22 PM
  4. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM
  5. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 08:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21