Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Qt CreatorWindows Hello World using Qt Creator under Windows

 

Hello World (or 'The Hello World program') is a standard example program to see if your programming environment works. Note that this example code is not standarized, so multiple and similar variants are on the Internet. A more demanding example is Hello Boost, which also tests if the Boost libraries are installed correctly.

 

 

The (C++) code of Hello World is as follows:

 

#include <iostream>

int main()
{
  std::cout << "Hello World\n";
}

 

Under some IDE's, when the program is run, a window pops up and immediatly disappears. This is okay (because the program runs). If you want the program to wait for a key press, change the code to the following:

 

#include <iostream>

int main()
{
  std::cout << "Hello World\n";
  std::cin.get();
}

 

Below, a complete Qt Creator project and its created files is shown.

 

 

 

 

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file

 

#-------------------------------------------------
#
# Project created by QtCreator 2010-09-29T14:58:49
#
#-------------------------------------------------
QT       += core
QT       -= gui
TARGET = CppHelloWorld
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

 

 

 

 

 

main.cpp

 

#include <iostream>

int main()
{
  std::cout << "Hello World\n";
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict