c++ GUI Qt4 的关于forward declaration of "class xxx 的错误"

C++ GUI Qt4 23页的程序在编译时出了个错误ubunto终端显示错误如下main.cpp:18:43: error: invalid use of incomplete type ‘class QPushButton’ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(lineEdit->hasAcceptableI ^In file included from /usr/local/Trolltech/Qt-4.8.1/include/QtGui/QDialog:1:0, from main.cpp:2:/usr/local/Trolltech/Qt-4.8.1/include/QtGui/qdialog.h:53:7: note: forward declaration of ‘class QPushButton’ class QPushButton; ^Makefile:213: recipe for target 'main.o' failedmake: *** [main.o] Error 1包含一个头文件#include就可以了!哈哈

你可能感兴趣的:(c++ GUI Qt4 的关于forward declaration of "class xxx 的错误")