QApplication: No such file or directory
-
This has been asked numerous times on this and other forums and I even had this error before and it used to be resolved using said recommendations but this time no proposed solutions work.
Basically the above title is the error I get and my .pro file is:
@TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qtSOURCES += main.cpp
finddialog.cppHEADERS +=
finddialog.h
@I tried adding the following with no avail:
@QT += widgets
QT += gui@Pleaas note, source code is flawless as it comes out of C++ GUI Programming with Qt 4 one of the beginning examples.
-
Try including <QtWidgets/QApplication> if the hint from Zlatomir does not work.
-
If you are using Qt Creator, just go to "Build" and select "Rebuild All".
If you are on terminal, best clean the build dir, then run:
@
qmake
make
@ -
Hi,
In your pro file you have
@CONFIG -= qt@
that removes completely Qt from your project, just remove that line and run qmake again (depending on your Qt version you might need to add QT += widgets)
Hope it helps
-
[quote author="SGaist" date="1364159071"]Hi,
In your pro file you have
@CONFIG -= qt@ [/quote]
Hahaha! Amazing how nobody noticed that before! :D Nice catch, SGaist!
-
CONFIG contains qt by default, so no need to add it, just remove the "CONFIG -= qt" line from your pro file.
Including "QtWidgets" includes in fact All headers related to the QtWidget module, that's why it works. It's cleaner to only include what you currently uses i.e <QLineEdit> or if you want a clearer separation of modules in your include part <QtWidgets/QLineEdit>.