Qt 5.3. QtWidgets: No such file or directory #include <QtWidgets>

c++, qmake, qt, qt5, qtwidgets

Solution

You need to double check that you completed all these steps:

Module installed

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

You re-run the Qt 5 qmake.

Having said that, I would like to remind you that including the whole module is not a good idea as it includes all the widgets related things. Try to narrow it down to the headers that you really need.

Problem

I want to compile Qt example. I get error QtWidgets: No such file or directory #include ``` greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - does not help QT += widgets - does not help INCLUDEPATH += /opt/Qt/5.3/Src/qtbase/include/ - does not help ``` Qt 5.3. Ubuntu 14.04 x64.

Original source