[Solved] QApplication: No such file or directory
I got Qt5 installed on Opensuse 12.2.
I tried to compile some example project that compiled successfully on Qt 4.8.
Now I get error message "QApplication: No such file or directory"
I think the PATH to library is missing while I installed locally on /home/
Where should I edit?
How do you include QApplication header? In Qt5, it resides in <QtWidgets/QApplication>, while in Qt4 it was <QtGui/QApplication>.
I think the module isn't added in .pro file, so did you added QT += widgets in your .pro file?
//anyway if the module is added the header can be included with #include <QApplication> you don't need <QtWidgets/QApplication> or <QtGui/QApplication> in Qt4 (that works with both Qt4 and 5)
Adding QT += widgets in .pro file made the trick. Thanks.
Why does qmake not include these, or what must one do in the source to ensure qmake auto generates this line in the .pro file ?
qmake will never generate anything in your .pro file. Those files are config files for qmake to use, not the other way around. If you create a new project in recent versions of Qt Creator, this line will be added for you in standard app template.
Ooh ok, that make more sense now, thanks for the reply.
Sorry for hijacking the thread by the way :D
The "Adding QT += widgets in .pro file" really helped me as well. Thanks.
I'm happy, too. I solved.
Why qmake --project is doing a so simple task in a wrong way?
can qmake -project add "QT += widgets" to .pro automatically ?
Just to say what happened to be my problem, it was a dumb error:
I was following a guide that had me open an empty QT project, which gave me a .pro file but left it empty. I had filled in some data and "TEMPLATE = application" as they has mentioned it. I already had the "widgets" line but it still couldn't find the library as I included it in the .cpp file. When I changed it to "TEMPALTE = app" the .pro file was parsed, and the file to include resolved correctly (QApplication).