Hey all.

When you have the whole program running, and is executed it's running at the black console window. How are the programs made so that they run with GUI interface and stuff like that? Are they exported differently and where are the images and things put together ? Thanks.

Hey all.

When you have the whole program running, and is executed it's running at the black console window. How are the programs made so that they run with GUI interface and stuff like that? Are they exported differently and where are the images and things put together ? Thanks.

First you can't use pure C++ to implement GUI, with that said you can either learn to code GUI using the OS API's or use some well know libraries for GUI.

>>How are the programs made so that they run with GUI interface and stuff like that?

GUIs are made through the use of external libraries (either OS APIs or other (cross-platform) GUI libraries).

Usually it is not really recommended to start making GUI applications until you have a pretty good grasp of OOP, since most GUI libraries are object-oriented and rely heavily on things like pointers, inheritance, polymorphism, abstract interfaces, event-driven software, etc. However most OS APIs and some simple GUI libraries use what is essentially a collection of C-style functions, but they are generally much harder to use (as in, it makes you write a lot of code, in a painful way).

Qt is a free GUI toolkit that is very good and cross-platform (but there are others like MFC, WinForm, wxWidget, VCL/CLX, etc.). I would recommend starting with Qt. If it turns out that it seems too complex, then maybe you will have to wait some more to get a more solid grounding in OOP and C++ (none of the other GUI tools will be any easier). Just follow online tutorials and start from there.

>>Are they exported differently

As for integrating console-program code into a GUI, it is mostly a matter of implementing the event-handlers (code that executes when the user does something, like clicking a button or menu). Implementing the event-handler is basically just normal C++ coding (include the headers you need, and code). The second difference is that input/output is not through the console (cin/cout or stdin/stdout) but through setting the text or values inside the text-boxes and stuff.

>>where are the images and things put together ?

This is specific to the GUI library. Most GUI libraries are complete toolkits (like for Qt) with an IDE to edit the code (e.g. QtCreator), an interface designer to place the buttons and images to create the GUI the way you like it (e.g. QtDesigner), and a build system (e.g. qmake). These three together handle all this stuff and packages the whole thing in an executable. Note that some GUI toolkits have all three-in-one (which you might prefer as a beginner, but it is usually not very convenient for larger projects). Most GUI toolkits also come with a lot of useful features to load/save images, load/display videos, plot graphs, embed a 3D window, play sounds, query databases, and many more things like that which are useful to interact between the user, the program, and the world.

Edited 5 Years Ago by mike_2000_17: n/a

For GUI interface applications, you can use the available tools like MFCs, Winforms in visual c++. Here they don't need to be exported. And built in tools are available there to put images, text and other stuff together.

ve always wondered how ..they do the gui..in c++..i think java..u ve to import jframe or smthing related to that

Qt Creator is your best bet and there is A TON of tutorials and help all over the net for it. Have yet to learn it myself however. ><

This article has been dead for over six months. Start a new discussion instead.