Why add "QT + = Widgets" to the pro file in QT5

Source: Internet
Author: User

Write "Qt+=widgets" in pro file to introduce qtwidget this module,qmake when generating makefile, will set up include path and Lib path, set libs at link time.

QT + = Widgets consists of two parts:

1:lib, this is the path of the Lib and the file name of the Lib file.

2:include, the path of *.h is set in the pro file, and the. h file name is set in the code # # #

QT + = Widgets Seemingly can be written separately (roughly):

include+= A string of paths (because filenames appear in the code as include, so there is no need to have filenames)

lib+= a string of paths +-l filename +-l file name ....

If only include <QApplication> in the source code only introduces the declaration, but does not have LIB, so the link will be wrong.
This is due to the C + + header file and lib separation of this design pattern, the modern language is basically used package management, with import to solve.

Why add "QT + = Widgets" to the pro file in QT5

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.