Qt program error records

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.