Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Problem with Qt empty projet
Nabil last edited by
Hello every body,
i have a little problem with Qt. when i open a new project, i choose empty project Qt.
i then when it is open i can't include QApplication i don't know why ? can you help me please.
I recommend starting with a "Qt Gui Application" or a "Qt Console Application" instead of a blank project. If you choose those, Qt Creator will help you set up some important parts.
But to answer your question:
Your .pro file is empty. You need to add the modules you want. All Qt projects automatically include the Qt Core and Qt GUI modules, but you'll need to add other modules yourself.
QApplication belongs in the Qt Widgets module. To include that, add the line "QT += widgets" to your .pro file.
lex last edited by
The solution is adding this
QT += widgets
line to your *.pro file, as JKSH said. Don't forget to save it and you'll be able now to include <QApplication> module to your main.cpp