views:

469

answers:

6

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.

(RE)EDIT:

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.

EDIT:

Link to QT Please...

+7  A: 

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, than Qt is not an option.

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

sth
OK, so what will work with c then?
Moshe
@Moshe, yes GTK+ is written in C.
Luca Matteis
Doesn't QT require payment for commercial use? Not that he said it's commercial, but he talks about mac/win/lin and iPhone.
phkahler
@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.
sth
GTK support for Macs is not very good unless you want to run X11, and that has its own downsides.
mikerobi
+1  A: 

Qt is a C++ library. Other cross platform libraries that you might consider are wxWidgets (C++), and GTK (C).

All three of the presented libraries are fully cross platform. You can also look at Tcl/Tk, but that's a toolkit :).

Kornel Kisielewicz
GTK is C++, really?
Alex B
Nope, corrected.
Kornel Kisielewicz
wxWidgets is C++, GTK+ is C.
Ken
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++.
e8johan
A: 

I'd strongly suggest questioning why your project would need to be in C. There are many benefits to C++, and the idea that C performs intrinsically better is mostly a myth. For some hard data on that, check out Bjarne Stroustrup's Learning C++ as a New Language.

If for some strange reason you feel you must use C and not C++, then Qt is not for you. It was designed from the ground-up as a C++ library. But if at all possible you should give it a try, it has a pleasing design and is well-documented!

If you must stick to C then there's always GTK. The underlying API of GTK+ is C, but bindings also exist for C++ called GTKmm. I'm not a big fan of it from a design perspective, but it does power the Gnome desktop (Ubuntu's default)...and Google is using it for their version of Chrome for Linux. So it has some cred.

Hostile Fork
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++.
mcl
@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
zebrabox
C'mon though, the question is "Cross platform GUI framework"...I've heard this a couple times before from people who know C and just don't want to learn C++. And the Stroustrup paper stands on its own merits regardless of who wrote it. Did you *read* it?
Hostile Fork
@HostileFork: Do you troll other language tags informing them that C++ would be a better alternative than C#, Perl, Ruby, Python and Lisp?
mcl
@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.
Hostile Fork
+1  A: 

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.

Bryan Oakley
A: 

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

RBerteig
A: 

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

Hernán Eche