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