In this lesson, we demonstrate how to create a new Qt project.

Start Qt Creator (v.3.4.1 used in this tutorial) and choose to start a New Project . From Application , select Qt Console Application , and click Choose…​ to proceed.

QtNewProject1
Figure 1. Create new project - step 1

Enter the project name, project directory location, and click Next .

QtNewProject2
Figure 2. Create new project - step 2

Click Next to use the default Kits setting.

QtNewProject3
Figure 3. Create new project - step 3

Complete project creation by clicking Finish .

QtNewProject4
Figure 4. Create new project - step 4

This creates a new project containing a Qt configuration file (.pro file) and a main.cpp file with the following code.

QtNewProject5
Figure 5. Create new project - step 5

Now we test to see if everything is in working condition by adding a greeting message to the program.

#include <QCoreApplication>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
  QCoreApplication a(argc, argv);

  cout << "Hello World !" << endl;

  return a.exec();
}

Go to Build , Build Project (Ctrl-B) and build the current project.

QtBuild
Figure 6. Building Qt project

Now run it via Build , Run (Ctrl-R)

QtRun
Figure 7. Running Qt project

A new console window will appear and displays the welcome message indicating everything is in order. Click X to close the program.

QtRunResult
Figure 8. Hello World program output
Note

If your console window does not contain the welcome message, you will need to copy the following 5 .dll files from Qt installation direction to project workspace.

  • icudt53.dll

  • icuin53.dll

  • icuuc53.dll

  • libstdc++-6.dll

  • Qt5Core.dll

QtCopyDll
Figure 9. Copy the missing dll files so output will show up in console window