标签:for idg tab ati find min git 不能 tin
并需要在pro文件里加上
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
并将引用的#include <QtGui>替换为#include <QtWidgets>
C++ GUI Programming with Qt 4上一段代码,编译不能通过:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
finddialog.cpp: In constructor ‘FindDialog::FindDialog(QWidget*)‘:
finddialog.cpp:5:38: error: invalid use of incomplete type ‘class QLabel‘
In file included from finddialog.cpp:2:0:
finddialog.h:7:7: error: forward declaration of ‘class QLabel‘
finddialog.cpp:6:17: error: invalid use of incomplete type ‘class QLineEdit‘
In file included from finddialog.cpp:2:0:
finddialog.h:8:7: error: forward declaration of ‘class QLineEdit‘
finddialog.cpp:7:7: error: invalid use of incomplete type ‘class QLabel‘
In file included from finddialog.cpp:2:0:
finddialog.h:7:7: error: forward declaration of ‘class QLabel‘
finddialog.cpp:8:48: error: invalid use of incomplete type ‘class QCheckBox‘
In file included from finddialog.cpp:2:0:
finddialog.h:6:7: error: forward declaration of ‘class QCheckBox‘
finddialog.cpp:9:57: error: invalid use of incomplete type ‘class QCheckBox‘
In file included from finddialog.cpp:2:0:
finddialog.h:6:7: error: forward declaration of ‘class QCheckBox‘
finddialog.cpp:10:42: error: invalid use of incomplete type ‘class QPushButton‘
|
在Qt官网wiki找到了答案:http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5
Change all instances of
1
|
#include <QtGui>
|
to
1
|
#include <QtWidgets>
|
标签:for idg tab ati find min git 不能 tin
原文地址:https://www.cnblogs.com/feiyufu/p/9999727.html