我刚刚安装了基于Qt 5.0的Qt Creator 2.6.1.
我正在尝试打开4.8上的项目,但我无法编译它.它不断向我显示“不是这样的文件或目录”的错误.
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
还有很多.
我将qmake.exe路径添加到PATH …我还需要做其他事吗?
阅读从Qt4到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>