Cross Platform C library for GUI Apps?

59,006

Solution 1

If you are looking for a C++ library, then Qt basically does what you are looking for. If you want to stick to pure C, then Qt is not an option.

As a C framework you could use GTK+, it works on Linux, Windows and OS X.

Solution 2

Take a look at the IUP Toolkit. It is written largely in C, and is also easily bound to Lua.

Solution 3

To complete this post Allegro has to be here =)

http://www.talula.demon.co.uk/allegro/ Allegro Game Library, have many graphics functions and a basic GUI library

And an explicit gui (and very simple) Allegro based library

http://cgui.sourceforge.net/index.html

Both multi-platform

Solution 4

One that I have considered using was the EFL, as it's quite fast, simple, small, but powerful. I would recommend diving into Elementary, their simplest GUI toolkit, and then later on, once you get comfortable with it, move to EDJE, which is not as simple, but much more powerful.

Solution 5

Another option is Tk, which is a GUI library written in C. It comes with Tcl, a scripting language also written in C. These were designed from the ground up to be embedded in C programs.

Share:
59,006
Moshe
Author by

Moshe

iOS Engineer Website | GitHub | Careers | App Store

Updated on July 09, 2022

Comments

  • Moshe
    Moshe almost 2 years

    Free of charge, simple to learn/use, Cross Platform C library for GUI Apps? Am I looking for Qt?

    Bonus question: Can I develop with the said library/toolkit on Mac then recompile on PC/Linux?

    Super Bonus Question: Link to tutorial and/or download of said library.

    The truth is that I'm in the process of catching up on the C family (coming from web development - XHTML/PHP/MySQL) to learn iPhone development.

    I do understand that C is not C++ or ObjectiveC but I want to keep the learning curve as simple as possible. Not to get too off topic, but I am also on the lookout for good starter books and websites. I've found this so far.

    I'm trying to kill many birds with one stone here. I don understand that there are platform specific extensions, but I will try to avoid those for porting purposes The idea is that I want to write the code on one machine and just compile thrice. (Mac/Win/Linux) If Objective C will compile on Windows and Linux as well as OS X then that's good. If I must use C++, that's also fine.

  • Moshe
    Moshe over 14 years
    OK, so what will work with c then?
  • Luca Matteis
    Luca Matteis over 14 years
    @Moshe, yes GTK+ is written in C.
  • e8johan
    e8johan over 14 years
    gtkmm is C++, so you could say that GTK is C++. As is Qt Python, Ruby, php, etc. When providing bindings it is hard to bind downwards, so C++ is not (conveniently) C, as C can (roughly and quite unfairly) be seen as a subset of C++.
  • sam1132
    sam1132 over 14 years
    Got some "hard data" that comes from someone besides the author of the language? Stroustrup is the single least objective observer possible on the question of C vs. C++.
  • zebrabox
    zebrabox over 14 years
    @mcl. Agreed. @Hostile Fork : Bit of a sweeping statement! All depends on what your doing, the compiler you are using and the target hardware. C++ can ( but not always) lead to single object centric approaches which can limit performance by cache-thrashing. We've learnt this the hard way in the games industry
  • sam1132
    sam1132 over 14 years
    @HostileFork: Do you troll other language tags informing them that C++ would be a better alternative than C#, Perl, Ruby, Python and Lisp?
  • HostileFork says dont trust SE
    HostileFork says dont trust SE over 14 years
    @mcl: I follow the #qt tag and the OP asked specifically about Qt. I suppose one can say "NO! Qt is C++ you want GTK+" and leave it at that, and you are free to answer that way if you like. But I personally don't feel GTK is that good, and I'd hate for someone to avoid Qt because they hadn't taken the time to consider if their reasons for using C instead of C++ were based on incorrect assumptions. So I include some discussion of that with my answer.
  • phkahler
    phkahler over 14 years
    Doesn't QT require payment for commercial use? Not that he said it's commercial, but he talks about mac/win/lin and iPhone.
  • sth
    sth over 14 years
    @phkahler: No, it doesn't, you can use it as LGPL (so you can use it in commercial closed source projects as long as you make modifications of the QT library itself available). There also is a commercial license if you want to make modifications to QT itself that you wouldn't want to make available under LGPL.
  • mikerobi
    mikerobi about 14 years
    GTK support for Macs is not very good unless you want to run X11, and that has its own downsides.
  • Roman A. Taycher
    Roman A. Taycher over 11 years
    Note gtk+ now supports OS X without X11(I believe this is no longer labelled experimental and the latest version of gimp for OS X ships a non-x11 build) although I would still probably heavily recommended qt over gtk+ for OS X.
  • cib
    cib about 11 years
    Aside from the fact that "Are you sure you don't want to ask something else?" isn't an answer, the obvious reason to want a C API, is because you're not using C, but a language that can interface with C, like luajit, terra, D, rust and so on. I find that good wrapper libraries rarely exist, and would rather have the full power of the native C API.
  • AntonioCS
    AntonioCS over 8 years
    After spending the past 4hours trying to get GTK+ on windows I would not recommend it. Its a real nightmare to get this running and even when you do there are still issues because you need to compile this in msys2...
  • Aaron Franke
    Aaron Franke over 5 years
    Does GTK+ also work with C++?
  • Webwoman
    Webwoman about 5 years
    QT is not free of charge for commercial uses
  • sth
    sth about 5 years
    @Webwoman: It is available as an LGPL library (See for example qt.io/download), so you can use it free of charge for whatever purpose you want. That includes using it for a commercial closed source program, as long as you keep the Qt library itself as LGPL.
  • Webwoman
    Webwoman about 5 years
    thanks for your answer, I have seen this comment and I would you opinion if possible: quora.com/Can-I-use-the-free-QT-for-c++-commercially, the top comment, I know you are not a lawyer it s just in the continuity of our discussion
  • sth
    sth about 5 years
    @Webwoman: I don't really follow the logic in that comment, I don't see why a commercial license would necessarily be "safer". The commercial license subscription could be discontinued or the terms could change for the future, and what do you do then? The LGPL is a well known and often used license. I wouldn't expect any legal surprises to suddently come up in it that haven't been noticed before. It has definitely been analyzed more closely than some special Qt license, I assume.
  • Hrisip
    Hrisip almost 3 years
    does it actually work on Windows? I tried installing it, but it's way too cumbersome, and not even sure it's possible right now