c++ GUI Qt4 的关于forward declaration of "class xxx 的错误"
程序员文章站
2022-03-23 19:36:08
c++ gui qt4 23页的程序在编译时出了个错误ubunto终端显示错误如下main.cpp:18:43: error: invalid use of incomplete type &lsq...
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就可以了!哈哈