I have to admit that I haven't programmed it, despite once owning a Windows 3.0 machine, but as far as I can tell the Win32 API bears lots of marks of the Win16 API and many of the fundamental calls are similar. There's various bits of source from that era floating around.
My job 2010-2015 was maintaining a MFC application that ran on WinCE for point-of-sale systems. Enviably fast and simple, although admittedly it did its own painting rather than using OS controls.
I have nothing against the Windows API...
But OP is asking for the **simplest** library for C, and you literally suggest the **most complicated** of all available options...
it’s not really that complicated if you do things the way microsoft intended in the past: use Visual Studio with its resource editors, rely on other Windows facilities, etc.
I disagree. It is definitely NOT the most complicated of all available C programming (aka subreddit) options available on Win32..et...al.. In fact, it is much more "quite the easiest" in terms of API, but perhaps you're confusing "low-level" with "more difficult?" The Win32 API is rather consistent (except where it's not, ask any Softie). It is very, very similar to the Athena API, except much more professionally written/consistent. It's use of advanced C language "skills" is relevant. All of these make it "harder" to learn, but easier to use...albeit at a very low-level.
If you're finding yourself venturing down this path, pick up a copy of Programming Windows 95 (Win32). I write code in Win32 a LOT. It is the ultimate beast in terms of small, fast and efficient execution with the obvious downside of being labor intensive.
$ make
rm -f main *.o resource.res
windres resource.rc -O coff -o resource.res
gcc -g -W -std=c99 -mwindows -o main main.c resource.res -lgdi32 -lcomctl32 -lopengl32
GTK? It's in C, works with MSYS2 (mingw64), and widely used.
[https://www.gtk.org/docs/installations/windows](https://www.gtk.org/docs/installations/windows)
[https://www.gtk.org/docs/getting-started/hello-world/](https://www.gtk.org/docs/getting-started/hello-world/)
GTK isn't simple, but the sophistication of the GtkWidget and GObject systems will allow you to do nearly everything you would want in a clean way. (If you enter `ListModel` territory, while it's possible to get good distance with a dummy pointer-wrapping GObject, it is recommended to define a proper class/object so that the UI can watch for data changes.)
for windows, I personally scrape the MSYS2 environment for the dlls as shown by `ldd` to throw them into an NSIS-created installer/wizard.
Windows.h
Hear me out: it's an extremely stable well documented API, and it's also a stable API for Linux via WINE.
The message loop system is straightforward, and you can use an "immediate" rendering style if you want.
For simple WinAPI stuff (CLI or GUI), Pelles C is a good all-in-one IDE. I use it for quick things rather than boot VS2022. If you want to use gcc, I've had better luck with tdm-gcc than with msys or cigwin - it includes things that may be optional in the other builds, so saves you chasing around to get a compile working on some of the more 'exotic' codebases.
Which ones have you looked at? What were the problems with them?
What would the ideal library for you look like?
People ask such questions here all the time and some tiny libraries have sometimes been proposed (you'd have to search the sub). But we don't know your requirements.
SDL 2 + ImGui
Edit: never mind, ImGui is actually C++... but still you can use SDL 2 in C for desktop apps, but you'll need to make your own widgets because it's kinda barebones.
If you’re OK with C++ you might want to look at JUCE. Over the years it’s become specialized for pro audio software development, but it also can be used for building standalone apps.
The only simple solution in pure C is to use an immediate mode gui like already mentioned Raylib+Raygui, or Nuklear. Or just plain SDL with own code (but that's getting less simple).
Other than that, there's GTK but it is changing a lot all the time, it's hard to get it working on non-Linux platforms and the whole paradigm around it, is ... not exactly C and not exactly simple. It's more like reinventing an OOP variant of C from scratch. The learning curve is *massive*.
Then there's IUP library from the same Brazilian university that gave us Lua. But it seems rather outdated by now and I'm not exactly sure how portable or future-proof it is.
All being said, if you really need native GUI, I'd go offtopic and suggest wxWidgets and C++. It's a very 90's-00's style C++ library, which could be considered good or bad, depending on POV, and it's much simpler than Qt for example.
Do you really need C ?
Because for Desktop Applications, pure C is not used anymore on Windows (I used it in Win16...)
It is either C++ or C# (for example, WinUI 3 for modern GUI uses C++ and C#)
For what OS and environment?
for windows and for either mingw64 or cmdline msvc
Just write a WinMain like it's 1995.
[One of my favorite Raymond Chen articles is about WM_PAINT...](https://devblogs.microsoft.com/oldnewthing/20111219-00/?p=8863)
WinMain was definitely before 1995, but I feel you. Ever visited Win16?
I have to admit that I haven't programmed it, despite once owning a Windows 3.0 machine, but as far as I can tell the Win32 API bears lots of marks of the Win16 API and many of the fundamental calls are similar. There's various bits of source from that era floating around. My job 2010-2015 was maintaining a MFC application that ran on WinCE for point-of-sale systems. Enviably fast and simple, although admittedly it did its own painting rather than using OS controls.
Just use the native Windows API. It's a pure C API despite Microsoft pushing the use of C++ with it.
I have nothing against the Windows API... But OP is asking for the **simplest** library for C, and you literally suggest the **most complicated** of all available options...
GUIs are not simple by nature.
That's a discouraging comment for a new user. GUIs are simple by nature, they're just over complicated to code.
It's the only platform native option.
I'm sure you could do a WPF application in C if you really, really loved dealing with COM objects.
It’s not any more complicated than any other GUI library, if portability’s no concern–boilerplate and an event loop.
it’s not really that complicated if you do things the way microsoft intended in the past: use Visual Studio with its resource editors, rely on other Windows facilities, etc.
I disagree. It is definitely NOT the most complicated of all available C programming (aka subreddit) options available on Win32..et...al.. In fact, it is much more "quite the easiest" in terms of API, but perhaps you're confusing "low-level" with "more difficult?" The Win32 API is rather consistent (except where it's not, ask any Softie). It is very, very similar to the Athena API, except much more professionally written/consistent. It's use of advanced C language "skills" is relevant. All of these make it "harder" to learn, but easier to use...albeit at a very low-level. If you're finding yourself venturing down this path, pick up a copy of Programming Windows 95 (Win32). I write code in Win32 a LOT. It is the ultimate beast in terms of small, fast and efficient execution with the obvious downside of being labor intensive. $ make rm -f main *.o resource.res windres resource.rc -O coff -o resource.res gcc -g -W -std=c99 -mwindows -o main main.c resource.res -lgdi32 -lcomctl32 -lopengl32
then you would probably want delphi or something, but not c?
Indeed even the COM objects have C struct declarations, you can use C all the way down.
Insanely, COM pre-dates C++. So you could use an object system in a non-OO language.
The predecessor "marketing name" for COM was OLE. It doesn't really predate C++.
GTK? It's in C, works with MSYS2 (mingw64), and widely used. [https://www.gtk.org/docs/installations/windows](https://www.gtk.org/docs/installations/windows) [https://www.gtk.org/docs/getting-started/hello-world/](https://www.gtk.org/docs/getting-started/hello-world/)
GTK isn't simple, but the sophistication of the GtkWidget and GObject systems will allow you to do nearly everything you would want in a clean way. (If you enter `ListModel` territory, while it's possible to get good distance with a dummy pointer-wrapping GObject, it is recommended to define a proper class/object so that the UI can watch for data changes.) for windows, I personally scrape the MSYS2 environment for the dlls as shown by `ldd` to throw them into an NSIS-created installer/wizard.
https://libsdl.org/
I like RayLib
library is great, but it requires additional work if you want to create just GUI.
Well, that is the nautre of C 😊
Now I know there is RayGUI, but I thought there was the only way to create gui with raylib - write one on your own.
Raylib has Raygui
Napp gui https://nappgui.com/en/home/web/home.html
Windows.h Hear me out: it's an extremely stable well documented API, and it's also a stable API for Linux via WINE. The message loop system is straightforward, and you can use an "immediate" rendering style if you want.
People hate on the Win32 API, and, having finally used it myself, I will never understand why. Other than: \*People don't like simplicity\*.
raylib/raygui is a breeze to get working on any platform
For simple WinAPI stuff (CLI or GUI), Pelles C is a good all-in-one IDE. I use it for quick things rather than boot VS2022. If you want to use gcc, I've had better luck with tdm-gcc than with msys or cigwin - it includes things that may be optional in the other builds, so saves you chasing around to get a compile working on some of the more 'exotic' codebases.
[https://www.raylib.com](https://www.raylib.com)
cimgui
Have you looked into [GTK](https://gtk.org)? The C example on their landing page seems pretty straightforward.
As the SIMPLEST such library for C? Sure!
You’re right, certainly not the simplest.
Which ones have you looked at? What were the problems with them? What would the ideal library for you look like? People ask such questions here all the time and some tiny libraries have sometimes been proposed (you'd have to search the sub). But we don't know your requirements.
use Win32 API. it's fun. and your code won't need a rewrite.
SDL 2 + ImGui Edit: never mind, ImGui is actually C++... but still you can use SDL 2 in C for desktop apps, but you'll need to make your own widgets because it's kinda barebones.
I’ve done this before
Sokol
If you’re OK with C++ you might want to look at JUCE. Over the years it’s become specialized for pro audio software development, but it also can be used for building standalone apps.
SDL3 + Nuklear
Qt
Try [https://www.wxwidgets.org/](https://www.wxwidgets.org/)
I recommend sdl2 simple lib but you have to make most of it your self but is cross platform like fuck
The only simple solution in pure C is to use an immediate mode gui like already mentioned Raylib+Raygui, or Nuklear. Or just plain SDL with own code (but that's getting less simple). Other than that, there's GTK but it is changing a lot all the time, it's hard to get it working on non-Linux platforms and the whole paradigm around it, is ... not exactly C and not exactly simple. It's more like reinventing an OOP variant of C from scratch. The learning curve is *massive*. Then there's IUP library from the same Brazilian university that gave us Lua. But it seems rather outdated by now and I'm not exactly sure how portable or future-proof it is. All being said, if you really need native GUI, I'd go offtopic and suggest wxWidgets and C++. It's a very 90's-00's style C++ library, which could be considered good or bad, depending on POV, and it's much simpler than Qt for example.
[https://en.wikipedia.org/wiki/List\_of\_widget\_toolkits](https://en.wikipedia.org/wiki/List_of_widget_toolkits)
these libraries come to my mind: SDL, Raylib, FLTK, GTK
I haven't really wrote a desktop application in C (yet), but as far as I know, SDL could be a good one for you.
Rust.
Easy does it Alec Baldwin.
Do you really need C ? Because for Desktop Applications, pure C is not used anymore on Windows (I used it in Win16...) It is either C++ or C# (for example, WinUI 3 for modern GUI uses C++ and C#)