Cross Platform C library for GUI Apps?

Viewed 63868

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.

8 Answers

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.

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 :).

You tagged this question about , which is a tag I follow. However, you are also asking with regards to programming.

If for some strange (or domain-enforced) 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.

Yet 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 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 historically powered the Gnome desktop (Ubuntu's default)...and Google chose it for their version of Chrome for Linux. So it has some cred and support there.

But do note that Ubuntu is choosing Qt5 to implement their next version of "Unity" in the desktop:

https://askubuntu.com/questions/281092/why-is-canonical-choosing-qt-over-gtk-for-unitys-next-generation


EDIT: You added:

If I must use C++, that's also fine.

"Must" is a strong word, but there is practically no comparison between C++/Qt vs. C/GTK. And the latter is becoming a thing of history.

Related