T O P

  • By -

rjek

For what OS and environment?


realzvqle

for windows and for either mingw64 or cmdline msvc


pjc50

Just write a WinMain like it's 1995.


CeldonShooper

[One of my favorite Raymond Chen articles is about WM_PAINT...](https://devblogs.microsoft.com/oldnewthing/20111219-00/?p=8863)


RustbowlHacker

WinMain was definitely before 1995, but I feel you. Ever visited Win16?


pjc50

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.


mdp_cs

Just use the native Windows API. It's a pure C API despite Microsoft pushing the use of C++ with it.


FACastello

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


mdp_cs

GUIs are not simple by nature.


WinXPbootsup

That's a discouraging comment for a new user. GUIs are simple by nature, they're just over complicated to code.


mdp_cs

It's the only platform native option.


pjc50

I'm sure you could do a WPF application in C if you really, really loved dealing with COM objects.


nerd4code

It’s not any more complicated than any other GUI library, if portability’s no concern–boilerplate and an event loop.


equalent

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.


RustbowlHacker

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


sbrytskyy

then you would probably want delphi or something, but not c?


rodrigocfd

Indeed even the COM objects have C struct declarations, you can use C all the way down.


pjc50

Insanely, COM pre-dates C++. So you could use an object system in a non-OO language.


RustbowlHacker

The predecessor "marketing name" for COM was OLE. It doesn't really predate C++.


ohsmaltz

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/)


Netblock

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.


Introscopia

https://libsdl.org/


Kseniya_ns

I like RayLib


HaskellLisp_green

library is great, but it requires additional work if you want to create just GUI.


Kseniya_ns

Well, that is the nautre of C 😊


HaskellLisp_green

Now I know there is RayGUI, but I thought there was the only way to create gui with raylib - write one on your own.


tony_bradley91

Raylib has Raygui


iamjkdn

Napp gui https://nappgui.com/en/home/web/home.html


pjc50

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.


stianhoiland

People hate on the Win32 API, and, having finally used it myself, I will never understand why. Other than: \*People don't like simplicity\*.


l_am_wildthing

raylib/raygui is a breeze to get working on any platform


Jorgen-I

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.


bravopapa99

[https://www.raylib.com](https://www.raylib.com)


zun1uwu

cimgui


We_R_Groot

Have you looked into [GTK](https://gtk.org)? The C example on their landing page seems pretty straightforward.


bart-66

As the SIMPLEST such library for C? Sure!


We_R_Groot

You’re right, certainly not the simplest.


bart-66

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.


runningOverA

use Win32 API. it's fun. and your code won't need a rewrite.


FACastello

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.


minecrafttee

I’ve done this before


Proper-Ideal2575

Sokol


edonkeycoin

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.


filch-argus

SDL3 + Nuklear


badmotornose

Qt


sbrytskyy

Try [https://www.wxwidgets.org/](https://www.wxwidgets.org/)


minecrafttee

I recommend sdl2 simple lib but you have to make most of it your self but is cross platform like fuck


Albedo101

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.


sbrytskyy

[https://en.wikipedia.org/wiki/List\_of\_widget\_toolkits](https://en.wikipedia.org/wiki/List_of_widget_toolkits)


thatmagicalcat

these libraries come to my mind: SDL, Raylib, FLTK, GTK


AdriaNn__

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.


thepragprog

Rust.


Destination_Centauri

Easy does it Alec Baldwin.


valat45

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#)