Reputation: 702
I just installed Qt Creator 2.6.1 based on Qt 5.0.
I'm trying to open a project made on 4.8 but I can't compile it. It keeps showing me errors of "not such file or directory".
error: C1083: Cannot open include file: 'QtGui/QApplication': No such file or directory
error: C1083: Cannot open include file: 'QDialog': No such file or directory
error: C1083: Cannot open include file: 'QMainWindow': No such file or directory
error: C1083: Cannot open include file: 'QWidget': No such file or directory
And many more.
I added the qmake.exe path to PATH...do I need to do something else?
Upvotes: 12
Views: 35648
Reputation: 81
I had this problem, made two changes
echo "QT += widgets" >> /fileProject.pro
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
Upvotes: 8
Reputation: 12321
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>
Upvotes: 21