把pro文件打开,在开始的地方增加一行:QT += core widgets
pro文件看起来如下:
######################################################################
# Automatically generated by qmake (3.0) ?? ?? 27 21:20:52 2013
######################################################################
QT += core widgets #Qt5
QT += core gui #Qt4
TEMPLATE = app
TARGET = hello
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += hello.cpp
保存pro文件,再编译(qmake->xxxxmake)