Qt program error records
1. Some programs use the setmainwidget () function. If you use QT 4.0 or later, the following error is returned:
error: ‘class QApplication’ has no member named ‘setMainWidget’
The error is due to version issues. setmainwidget is qt3, and this function is no longer used in qt4. If you want to be compatible with qt3, you can run the following statement before the program header file (not after the header file ):
#define QT3_SUPPORT
Then, the program with setmainwidget can be compiled successfully.
2. Error:
Fatal error: qvbox. h: no such file or directory
The preceding error occurs when you compile the home value of the qt3 tutorial in the qt4 compiling environment.
Solution: Change the header file to qboxlayout. h and modify the program content:
#include <qboxlayout.h>QVBox box;
Change to (or include ):
QWidget box; layout.addWidget(&quit); window.setLayout(&layout); window.show();
Then, the program can be compiled successfully.
3. To be continued...
Qt program error records