The qt4 application is developed in eclipse, and the problem and solution of the added controls are invisible.

Source: Internet
Author: User
Tags one more line qt designer

I started to learn QT these days and installed the qt4 designer. It is said that eclipse can also be used as the QT IDE, so I configured the QT development environment in eclipse (I can't stand the N multiple windows opened by QT designer ).

Then I found an article on the Internet titled using eclipse to develop qt4 C ++ programs

"Unknown.

Problem: when creating a qt gui project, eclipse automatically creates a blank form and generates an executable file. Then, I added several controls following the steps in the above tutorial and then built all. An error occurred:

Description resource path location type

Error: 'ui' does not declare helloworld. h/helloworld line 16 C/C ++ Problem

Description resource path location type

Error: Expected '; 'before' UI' helloworld. h/helloworld line 16 C/C ++ Problem

Description resource path location type

Error: iso c ++ does not allow the declaration of non-type 'helloworldclass' helloworld. h/helloworld line 16 C/C ++ Problem

 

After several timesExploration

The "ui_helloworld.h" file is found to beBlank

Of! AgainExploration

The file is generated through the helloworld. UI file. The command is as follows:

UIC helloworl. UI-O ui_helloworld.h

Enter the preceding command in the terminal to obtain the following error message:

UIC: file generated with too old version of QT designer

File 'helloworld. Ui' is not valid

In desperation, A helloworld. UI file is generated using qt4 designer and then converted using UIC,No problem!

Compare the helloworld. UI generated by eclipse with the file generated by qt4 designer, and find that the file generated by eclipse has one more line as follows:

<? XML version = "1.0" encoding = "UTF-8"?>

It is observed that the helloworld. UI file generated when the project was just created does not have this line. After each operation such as "add control" and "Modify attribute", this line will be added. So delete it and build all again. No problem! You can also add controls. AlthoughSolution
But before each compilation, You need to delete the first line of the. UI file, which is quite troublesome .. If there are many. UI files, isn't it annoying.It may be a problem with the qt4 version.
, Try upgrading, bless me!

 

When you upgrade QT to version 4.6 (see eclipse + qt4.6 (Linux)
),Problem Solving
You do not need to manually delete the first line of the. UI file"

Related Article

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.