标签:
C++ GUI Programming with Qt 4上一段代码,编译不能通过:
问题一:编译按钮为灰色,compile output提示找不到 .pro文件,
原因是有中文路径问题,导致不能识别.pro文件,全部用英文路径即可。
问题二:
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>
|
标签:
原文地址:http://my.oschina.net/u/1772925/blog/412519