Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QDialog not such file or directory - Qt Windows

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?

like image 783
Nick L Scott Avatar asked Jan 10 '13 14:01

Nick L Scott


1 Answers

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>
like image 106
pnezis Avatar answered Sep 19 '22 19:09

pnezis