Problem with Qt empty projet
-
wrote on 17 Sept 2013, 10:34 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. -
Hi,
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.
-
wrote on 22 May 2014, 18:53 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