Error QApplication: no such file or directory

Ramy Al Zuhouri picture Ramy Al Zuhouri · Jan 24, 2012 · Viewed 139.3k times · Source

I have installed C++SDK that have Qt but when I try compiling a code linking QApplication it gives me the error:

Error QApplication: no such file or directory

How do I link these libraries? I searched into the directories and there is a file named QApplication.h; So I tried to link it with -I (linking the directory) but it was still giving me that error.

Answer

Timmmm picture Timmmm · Jan 3, 2013

In Qt 5 you now have to add widgets to the QT qmake variable (in your MyProject.pro file).

 QT += widgets