我在编译QT应用时出现:qt/mainwindow.cpp:1:21: fatal error: QtWidgets: No such file or directory,请问如何解决,本人也网上搜索过了多次,都没见到可行方法,QT版本4.8.1,由于本为是新手学QT,所以麻烦大侠们看看如何是好? 谢谢啊。
make: Entering directory `/home/chenzm/work/fba-qt-hack/fbaqt-build-desktop-Qt_4_8_1_in_PATH__System__Release'
g++ -c -pipe -w -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DLSB_FIRST -DBUILD_QT -DINCLUDE_LIB_PNGH -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../fba-qt -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtMultimedia -I/usr/include/qt4 -I../fba-qt/src/burn -I../fba-qt/src/burn/devices -I../fba-qt/src/burn/drv -I../fba-qt/src/burn/drv/taito -I../fba-qt/src/burn/snd -I../fba-qt/src/cpu -I../fba-qt/src/cpu/z80 -I../fba-qt/src/cpu/i8039 -I../fba-qt/src/intf -I../fba-qt/src/intf/cd -I../fba-qt/src/intf/input -I../fba-qt/src/intf/audio -I../fba-qt/src/intf/video -I../fba-qt/src/intf/video/scalers -I../fba-qt/src/burner -I../fba-qt/src/burner/qt -I../fba-qt/src/dep/scripts -I../fba-qt/src/burner/qt -I../fba-qt/src/dep/libs -I/usr/X11R6/include -I. -I. -I../fba-qt -I. -o mainwindow.o ../fba-qt/src/burner/qt/mainwindow.cpp
../fba-qt/src/burner/qt/mainwindow.cpp:1:21: fatal error: QtWidgets: No such file or directory
compilation terminated.
make: Leaving directory `/home/chenzm/work/fba-qt-hack/fbaqt-build-desktop-Qt_4_8_1_in_PATH__System__Release'
make: *** [mainwindow.o] Error 1
14:03:39: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project fbaqt (target: Desktop)
When executing step 'Make'
这个是pro文件头,
QT += widgets opengl multimedia
------解决思路----------------------
QtWidgets Qt5.0以后才有的模块 你用的4.8版本没这个模块
QT += gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
------解决思路----------------------
Qt4.8 用的是QWidget,按照2楼的方式改.pro文件,再将程序里面QtWidgets的地方去掉。这个网上挺多的
------解决思路----------------------
或者楼主是想用
#include <QWidget>