r/C_Programming • u/BigBrainerr • Jul 20 '24
Question Good GUI libraries?
So Qt is C++ not C, which is fine cause i dont really need something as complicated as Qt.
Nuklear looked good but i havent seen any resources to learn it and it seems made for games rather than used standalone as a user interface.
So i would like to hear your suggestions and learning resources.
Oh, also cross-compatiblility is important please!
48
Upvotes
12
u/[deleted] Jul 20 '24
Imgui I've heard is good. I came across Leif the other day. Also raygui may be worth checking out.
30
u/veghead Jul 20 '24
FWIW, even though I'm a C die-hard and really dislike C++, I really love Qt. It's more than a GUI framework, has superb tooling, and means you don't have to use that bloody awful STL mess.
7
u/pedersenk Jul 21 '24 edited Jul 21 '24
Its not really even C++ either. It is a weird MOC preprocessor extension.
There aren't many options for C these days which I find weird. If you like big ugly software with sprawling dependencies, there is Gtk. Cross platform but a bit of a pain to build for Windows.
If you like the "classic" look of Motif, then that is actually quite good. Not to everyone's taste though. Cross platform but requires a 3rd party Xserver for Windows (i.e VcXsrv) and macOS (i.e XQuartz).
29
u/DFKproject Jul 21 '24
Gtk
4
u/c1aba0_1 Jul 21 '24
C bindings for the FLTK gui library, https://github.com/MoAlyousef/cfltk
7
u/bug0r Jul 20 '24
I like to use IUP from Tecgraf.
https://www.tecgraf.puc-rio.br/iup/
Tutorial:
https://www.tecgraf.puc-rio.br/iup/en/tutorial/tutorial.html
7
u/AflatonTheRedditor Jul 21 '24
Use raylib/raygui if you don't wanna build something robust or if you wanna make a quick prototype.
2
u/reini_urban Jul 21 '24
As the others I'm also only happy with gtk
2
u/Cyberdonkey2 Jul 21 '24
Learn how to make your own. Start here:
https://solhsa.com/imgui/index.html
Then go here:
https://nakst.gitlab.io/tutorial/ui-part-1.html
Finally, check this out:
https://www.rfleury.com/p/posts-table-of-contents
10
u/ripter Jul 20 '24
This might be unpopular, but I believe a web frontend is the best choice for a UI. I develop my projects using a simple REST API and a static HTTP server. The actual UI is web-based and runs in the default browser.
4
u/HunterRbx Jul 20 '24
win32 /s
4
u/tboy1977 Jul 21 '24
Windows API is so easy
1
u/jenhsun Jul 21 '24
LCUI
libui
1
u/onflapp Jul 21 '24
why dont you give GNUstep a try. It is multi platform and with very well designed API. It even includes gui builder (GORM)
1
u/aninteger Jul 21 '24
There's Luigi. Small, simple, single header.
1
u/MapleSzurp Jul 21 '24
I've built several application in GTK with C including a process monitor: https://github.com/reyncode/peek
1
u/DocEyss Jul 21 '24
You could call Raylib a GUI library if you wanted to
1
u/sjuut Jul 21 '24
Slint
1
u/gdf8gdn8 Jul 22 '24
EFL
1
u/your_sweetpea Jul 23 '24
Nuklear is far more usable standalone than you probably think -- I'd recommend checking out the xcb_cairo example: https://github.com/Immediate-Mode-UI/Nuklear/tree/master/demo/xcb_cairo/
While it doesn't give you the full picture exactly, it's fairly trivially portable to work with win32, Wayland, etc since it works with a software framebuffer rather than a hardware accelerated graphics API, and that's something that's fairly simple to set up on all modern windowing systems in my experience.
1
u/Due-Philosopher2244 Jul 21 '24
If you are hell bent on cross-platform, your options for good native UI come down to QT or wxWidgets. Both are unfortunately C++ only, with scripting language bindings available eg python,lua.
That said, there exists https://github.com/filcuc/dotherside which is a minimal c qt qml binding. Key words here are that it is Qt QML only, so you will need to learn qml. It also doesn't look actively maintained.
Personally, I had a very hard fallout with C++, so I always end up using QT python bindings.
Sadly, the rest of the world opted for the electron mess, and QT didn't do themselves any favors with the licensing.
1
u/the_Demongod Jul 21 '24
Java swing with a C backend is a good option if you want maximum cross-platform compatibility
-1
u/Netblock Jul 21 '24
If simplicity and portability are your primary concerns, it's probably better to develop a web page, and ship your app with a packaged embedded chromium browser. It'll feel gross, but webdev Is where the industry is for UI dev.
But if you insist on using C, GTK is written in C and thus has a native C API. It is reasonably portable; it standardises an ABI and its possible to compile for windows. But GTK is robust and powerful, and you're not really looking for that.
-1
u/[deleted] Jul 21 '24
I mean you always have SDL2
-1
u/No-Worldliness-5106 Jul 21 '24
Develop your own /s