About GUI

C++ doesn't seem to have a simple and a single consolidated way to make windows and work on graphics and GUI and all, when I search on youtube, I find many tutorials that use different methods and ways to create windows and use GUI such as SDL & Glew etc

I'm confused, which one to use?
Why do we always have to include files and do hard procedures to create windows etc or are there better ways? (idk, im still a beginner)


What are the best ways & methods to handle GUI, what should I use?
Doesn't C++ have a single unified way to handle GUI (without the need of including external files etc)?
C++ does not have a unified way to handle GUI. There's no standard library for GUI, unlike Java or C#. If you want to have a proper GUI in C++, you'll have to go with a third-party library. Qt is a good option, if you want just a straight GUI and not having to deal with graphical rendering and the rest of that stuff (SDL+GLEW).
@Ispil

Well, that's unfortunate :c
I don't understand how C++ understands all of the forms of GUI code, either from Qt or SDL (because they generate code differently and in different forms), etc if you know what I mean because those programs that facilitate the creation of GUI in c++ (libraries) must've used some of C++'s window/GUI functions that are already integrated

C++ gets pretty confusing in GUI
Last edited on
Your monitor is controlled by your operating system. Your operating system provides some functions that you can call to ask it nicely to show things on the monitor. You can call these functions yourself in your C++ code. It is generally difficult. These functions are different for every operating system, and since some operating systems have different options available for display managing, sometimes different across different installations of the same operating system.

Some people have written functions that do this interacting with the OS for you. These functions are simpler to use. This is what QT is. This is what SDL is. Code written by someone else that calls the OS functions for you, to make it easier for you.

Doesn't C++ have a single unified way to handle GUI (without the need of including external files etc)?

Here are some assumptions C++ doesn't make.

You have a monitor.
You have a keyboard.
You have a mouse.
You have an operating system.

So the idea of a "single, unified way to handle GUI" seems pretty silly (and to a large extent, is basically impossible) for a language as broadly deployable as C++.

Compare with Java, for example, which assumes that everyone everywhere is running their Java code on an identical machine with precisely defined characteristics.
Last edited on
closed account (Gvp9LyTq)
I going to hijack this thread and ask a question. Does anyone believe that C++ is a good choice for a GUI?

Everything I write is only used by one to three people so when I feel and need for a GUI I use javascript. It is not that I can't but I don't bother writing the GUI in C++ because it seems like too much trouble.
Last edited on
It's an excellent choice. Fast, adaptive, easy to write, solid libraries, easy integration with the OS API.
closed account (E0p9LyTq)
gennny wrote:
Does anyone believe that C++ is a good choice for a GUI?

"Old school" MS Windows apps were/are written in C/C++, so why wouldn't C++ be a good choice for a GUI app?

There are libraries for creating cross-platform GUI apps for operating systems other than MS Windows, Bjarne Stroustrup uses FLTK (Fast Light Toolkit) in his "Programming: Principles and Practice Using C++" book.

http://www.fltk.org/index.php
gennny said:
Does anyone believe that C++ is a good choice for a GUI?

Generally speaking, it may be faster to write the GUI in a language like Java or C#. There's nothing wrong with using C++, and a good GUI library will make it relatively easy to write a GUI with C++.
im a 2nd year student in cse , and i want to implement my c++ project with gui and i know nothing abut this .... please can somebody help me???
im a 2nd year student in cse , and i want to implement my c++ project with gui and i know nothing abut this .... please can somebody help me???


As mentioned above you can use Qt. Other options are WxWidget and FLTK

I personally use Qt, it has a great documentation and you can pick up C++ GUI Programming with Qt 4, Second Edition. It's easy to use especially Qt Designer.
Last edited on
closed account (1vD3vCM9)
I recommend using SDL and GLEW.
GLEW and SDL has to do with creating graphics contexts and windows. It doesn't create the UI itself.
Topic archived. No new replies allowed.