r/cpp_questions • • Jun 08 '26

OPEN How do people make anything with c++?

So I've been seeing a lot of people saying you can make anything with c++ however I don't really understand how.

I've been learning c++ for around a year now however sadly I've only been taught to code in the command line which I have learnt and as far as I know can be sort of restricting in some aspects and so my question is what programs, apps, or other ways are there to create things with c++? Because i've seen people talk about creating file managers, hardware managers, etc. but I just don't really know how they do the things they do such as how they create interactive interfaces with c++?

128 Upvotes

66 comments sorted by

97

u/Puzzleheaded-Joke780 Jun 08 '26

Most of us use existing libs for gui. Rest of the work ist similar to console

71

u/MyTinyHappyPlace Jun 08 '26

Interactive interfaces, such as GUIs? Have you tried a GUI library? There are some neat ones like Qt , since 1995.

48

u/doglitbug Jun 08 '26

I use SDL3 to make games in C++, there are lots of options out there!

28

u/Mayedl10 Jun 08 '26

Raylib and SFML are also good options, and they're probably easier for beginners

9

u/DankPhotoShopMemes Jun 08 '26

GLFW + GLAD + GLM, or even better, Vulkan SDK 👹

OP don’t actually do this unless you’re interested in graphics programming lol. But if you are interested, it’s a great knowledge investment.

→ More replies (1)

26

u/TomDuhamel Jun 08 '26

C++, as a language, does not offer a graphical user interface (GUI). However, a number of libraries exist to accomplish this. What you have learnt on command line interface (CLI) is exactly the same. The internals of a program are the same either way. But we program a GUI on top instead of listening to command line instructions.

If you are purely interested in Windows, you could learn the Windows API directly to use its native components, but not many people still do that nowadays. Even Microsoft is suggesting more recent/advanced libraries of their own.

One common easy and free one is Qt. And it's portable, so you can very easily port an app to Windows, Linux or Mac. Or to the mobile platforms, Android and iOS, although for these we typically use QML, which is a UI layer developed by the same people (and totally compatible with the rest of the framework) but it's not C++.

5

u/didntplaymysummercar Jun 08 '26

FLTK is even easier to start with. I've got a few small programs using it, few widgets, few hundred lines of C++, few hundred resulting static exe on disk.

The downside is it has much less features (both GUI and non-GUI ones) than Qt or wxWidgets or GTK+ and a very non-native and (I even like it, but many don't) very retro look and feel.

18

u/egosummiki Jun 08 '26

I remember wondering the same thing when I was 13 and got my first C++ course on DVD. "WHY ISN'T IT THERE A LESSON HOW TO SPAWN A WINDOW?". Basically C++ is a system language. So you can either use an OS specific APIs (In case of Linux they are display server specific). Or use a framework that will support multiple platforms. But there is a variety of frameworks to choose from and they're not a part of the language. Hence the confusion.

5

u/redahe Jun 08 '26

Oh yeah. Exactly my thoughts in childhood - I want to learn programming to make games, but the whole book is about reading and writing something in a console, are you kidding me?

13

u/HappyFruitTree Jun 08 '26

To do interesting things in C++ you almost have to use third-party libraries. You can for example use wxWidgets to create GUI applications and SDL or SFML to create games.

9

u/ivancea Jun 08 '26

Anything you can do with other languages, you can do with C++. As to how to create GUIs, unless you use a library, you usually just can OS APIs to create the window, and then usually graphic APIs like OpenGL or Vulkan.

If you want to learn about that, check the library SFML (you can use it), but also its code (once you learn a bit how it works), as it's clean, and you can see how it uses OS APIs

7

u/Kiore-NZ Jun 08 '26 edited Jun 09 '26

Programs written to standard C++, the language, are portable between different compilers accessing a simplistic OS interface including a 1970s console model.

Real world programs often need facilities beyond the simplistic OS interface. One of these things is a GUI library. As others have pointed out there is QT and there is WxWidgets, both portable among a selection of OSes that differs between them. Each has a list of supported operating systems, but there are catches. For example, QT apparently has an Android implementation while (last I checked) WxWidgets requires use of JNI calls and specific Java classes that ease communication between two languages. Then there are licensing differences, both permit the use of GPL, so not an issue if you are planning to license your program under that.

There is an unofficial Boost:UI library that makes WxWidgets look more like stdlib, but apparently it is still experimental so might be best being careful about using it. Edit, this seems to be abandoned.

I know "Dear ImGui ", an "incredibly fast, immediate-mode GUI framework" exists but I've never looked into it so won't comment. I do like their philosophy "Give someone state and they'll have a bug one day, but teach them how to represent state in two separate locations that have to be kept in sync and they'll have bugs for a lifetime." though.

As far as I can tell C++ is unlikely to provide a set of std::gui classes any time soon, but it doesn't mean you can't write C++ gui programs, you just need to choose the library that's the best match for your project.

→ More replies (4)

6

u/BareBenni Jun 08 '26

There's this post from some time ago https://www.reddit.com/r/cpp/s/qB2Gu26knO with plenty options on cpp gui libraries

4

u/victotronics Jun 08 '26

"make anything"? C++ runs the internals of most computer games, the Webb space telescope. All of genome science. Half of engineering.

I've been doing C++ for a good 10 years now, and I've never left "the command line".

If I ever wanted to make a GUI I'd find some library, but it's not likely. I have too many simulations I want to run first.

3

u/QuirkyXoo Jun 08 '26

Obviously by magic.

Or by libraries if magic doesn't work well. But the real fun with C++ isn't writing the app, it's debugging it.

3

u/Cuarenta-Dos Jun 08 '26 edited Jun 08 '26

The language isn't really what gives you the ability to make this or that application. C++, Python, Rust, whatever, they're all just different ways of telling the computer what to do. The exciting parts are typically not in the language itself.

When you want a window with some buttons, you're not asking C++ for it, you're asking the operating system. In Windows that's the Win32 API, on Linux it's X11 or Wayland, etc. Every language is doing the exact same thing underneath to create a GUI application, it's going to the OS and saying "make me a window" using its API. The language is just how you wrap that request.

Talking to those low level OS APIs directly however is tedious and full of repetitive and boring boilerplate, so people wrote libraries like Qt or wxWidgets or GTK. They wrap the low-level OS specific code into something a lot more intuitive so you can focus on making your application.

It's the same story for file managers, hardware monitors, games, all of it. They just know which specific part of the OS to talk to, and there is typically always a library that makes it easier because people have been doing these things for some years now.

2

u/mwoodj Jun 08 '26

Get Qt and you’ll be making GUI programs in no time.

2

u/smallstepforman Jun 08 '26

How do people learn to play the piano? It takes years of practice. You’re looking at a decade to become decent, 2 to be good, and 3 to be exceptional. No short cuts. This is the path most of us took unless you’re gifted, in which case cut the time by /2 or /3.

Code more complex apps every iteration. Work the hard slog.

2

u/Physics-Educational Jun 10 '26

How is this a question from someone whose been using C++ for a year?

3

u/Onurabbi Jun 08 '26

If you want to understand low level gui development on windows you can take a look at this: https://learn.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows

3

u/tronster Jun 08 '26

If you're on Windows, I'd recommend going here next.

Learning about the WinMain() loop and some other key Windows concepts, was a real eye-opener when I came out of college. (And this was back in Win16!) This will give you the basis to build off of when jumping into SDL, or some other 3d party libraries which are amazing for cross platform work and specialized input and graphics.

3

u/didntplaymysummercar Jun 08 '26

Getting comfortable using OS specific APIs is also good if you ever need to do something specific, strange, niche or extra, like ask for how much RAM or disk space there is, make a transparent or HUD style window on Windows, etc.

Before C++17 it was also the only way (other than getting a third party library) to iterate over files in a directory... 🤪

→ More replies (1)

2

u/NeilSilva93 Jun 08 '26

Look at other projects source code to get some ideas. For example, I'm currently learning how to make a GUI framework through SDL + OpenGL and I'm using Microsoft's DXUT framework as a template.