Lesson 0. Create Project with Qt Creator
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.
Enter the project name, project directory location, and click Next .
Click Next to use the default Kits setting.
Complete project creation by clicking Finish .
This creates a new project containing a Qt configuration file (.pro file) and a main.cpp file with the following code.
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.
Now run it via Build , Run (Ctrl-R)
A new console window will appear and displays the welcome message indicating everything is in order. Click X to close the program.
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.
|