There are some times that I make something and the terminal isn’t enough. I want to make it user-friendly and add buttons and dropdowns and stuff. I mainly write C, so I want a well-known and good GUI library for C. I have tried learning Qt but the documentation was awful and all the examples were for C++ or Python. I also am aware about libraries like imgui but it’s more for debugging UIs I think and not for normal applications that end users use.

I also would like the library to be platform-agnostic, or at least just work with Linux because that’s what I am using.

If you also code in C, what do you use to make GUIs? What do you suggest me to use?

Thanks in advance.

Also, if anyone suggests Electron or anything involving a browser, I will find them and remove one electron from each atom of theirs, turning them into smoke.

  • SorteKanin@feddit.dk
    link
    fedilink
    arrow-up
    5
    arrow-down
    7
    ·
    1 day ago

    I know it’s not really what you’re asking, but have you considered learning Rust? In many ways, Rust is more similar to C than C++ and is just as capable. There are quite a few very well documented (as is common in the Rust ecosystem) Rust libraries for GUIs, including efficient native ones or immediate mode ones and such. Just a suggestion.

    • brisk@aussie.zone
      link
      fedilink
      arrow-up
      2
      ·
      9 hours ago

      I’ve recently started a handful of projects exploring the rust gui ecosystem and the experience has been… disappointing.

      • The most mature native library I’ve seen is Druid, which is deprecated in favour of Xilem. Xilem is highly experimental.

      • Slint is somehow used by several industry partners, yet is incapable of rendering flowing text documents, and only just brought in text formatting (via Xilem’s text library oddly enough).

      • Egui seems a bit more capable, but it has the usual downsides of immediate mode gui without any of the typical upsides (you can’t intermingle gui elements with logic, the gui has to all go in one place).

      • Dioxus is reasonably capable but is absolutely webtech focused, which seems likely anathema to Op.

      • Iced I haven’t used beyond hello world, and I didn’t enjoy that experience.

      AFAICT the most mature rust gui libraries are the rust bindings for C’s GTK and C++'s Qt.

      I also - somewhat controversially - disagree with “very well documented”. Rust projects consistently have published API references - which is great! The actual quality of the API references is mixed. Actual documentation - such as intended usage, common patterns, design intent - are much more sparse. Of the GUI libraries I listed, only Dioxus and Slint come close.

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      16 hours ago

      +1 for being the kind of guy that goes to a Windows problem thread and suggests installing Linux (I have done that just for fun), but for Rust.

      I am currently learning Rust in my freer time and found “Rust by Example” not as appealing.
      For context, I learnt C when I was a kid, following “Programming with C - Schaum Series” and loved how it started by giving an idea of the memory representation for all data structures the way it is abstracted (or not so much) in C. Later in Uni, I hated “Let us C” (even though it seemed to do a similar thing at a glance) and “Let us C++” and just learnt the languages on the go as required by courses and projects (also simply used a C++ reference book instead of a course styled one).

      Now I see “Rust by Example” and see some parts not having been explained in the beginning, for which I would have to open the link to a section, much further ahead (it probably is not a course styled thingy). I will end up learning it, given time, but is there some material available that has a similar approach to introducing programming with Rust as the Schaum Series one was for C?

        • ulterno@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          4 hours ago

          the Rust book

          Do you mean this? https://doc.rust-lang.org/book/

          I actually started with that, but somehow redirected to “Rust by Example” and realise they were different, probably because of the same domain name and theme.
          Now I see, they did start with explaining ownership, which is one of the things I felt that i was missing, when I started moving forward in “Rust by Example”. Thanks for putting me back on track.

    • count_duckula@discuss.tchncs.de
      link
      fedilink
      arrow-up
      9
      arrow-down
      2
      ·
      1 day ago

      You probably love Rust as much as I do, but this is such an unhelpful comment. Dude mainly programs in C, asks about libraries for C, and you don’t even bother to list any native Rust libs that may give OP an incentive to even consider learning Rust.

      • SorteKanin@feddit.dk
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        1 day ago

        I think that’s quite harsh. As I said, I know it’s not what OP asked and it was just a suggestion. I’m just adding it as an option. Perhaps someone else reading the thread will find it useful, if not OP (who I don’t think you should speak for).

        OP mentioned they want native speed and were struggling with badly documented libraries. I feel like it was appropriate to at least mention Rust, considering those two things. Since when is widening a discussion slightly considered bad? You don’t have to reply to my comment either, if my comment does not seem interesting to you. Let alone downvote it. You can just leave it alone, it doesn’t hurt anyone.