QDialog not such file or directory - Qt Windows QDialog not such file or directory - Qt Windows windows windows

QDialog not such file or directory - Qt Windows


Read the transition guides from Qt4 to Qt5. Link1 Link2 Link3

One of the major internal infrastructural changes in Qt 5 compared to Qt 4 is the splitting of widgets from the QtGui module into a new QtWidgets module. This obviously will require buildsystem changes at least, but also causes the need for downstreams to add includes for headers which were not needed before, as those includes were removed from headers which now remain in the QtGui module.

Another includes-related issue in porting from Qt 4 to Qt 5 is dealing with includes for classes which have moved to the QtWidgets module. Whereas Qt 4 based code might use

#include <QtGui/QWidget>This must be updated to either#include <QtWidgets/QWidget>Or more portably (Which works in Qt 4 and Qt 5):#include <QWidget>


I had this problem, made two changes

  1. echo "QT += widgets" >> /fileProject.pro

  2. add #include QDialog in the file containign QDialog declarations

previously including QtGui was enough but QT5 splits widgets into more .h files, thus making necessary to include them. For example QtMenuBar was included in QtMenu.h but now it requires QtMenuBar.h to be #included