In Qt Creator, include path inclusion process (or how to find the corresponding header file)

Source: Internet
Author: User

When using Qt Creator to develop programs, you must include the # include header file.

As we all know, # include <> is used to include standard library header files. The path is in the include folder where the software is installed; # include "" is used to include custom files, the path is in the current user directory (or in the self-built project directory ).

For the latter, the path is more intuitive and easy to understand. For example, # include "lyc/daniel. h". The path is in the lyc folder of the current directory. (File inclusion can be nested .)

The following describes the path inclusion of the standard library header file of Qt.

1. Create a New GUI project. You can see the # include <QMainWindow> In mainwindow. h file.


2. In the include path of Qt, we can see that there are folders instead of files. Why?


3. Open the pro file in the project to know that the level-2 Directory QtCore and QtGui are already included.


That is, two files in include are added.


4. Search for QMainWindow in the include folder (Note that. h is not included). You can see that QMainWindow is found in the include \ QtGui directory.


5. Open QMainWindow in text. You can see


6. Open the qmainwindow. h file in the QtGui path (the same path as QMainWindow)


As you can see, there is a jump to the path, jump from the current path to the two paths, and then find the qmainwindow. h file in sequence from the src File


7. Open the qmainwindow. h file and you can see


At this point, we can see that the target header file is found.


During compilation, the code in the file will be copied to # include <QMainWindow>.






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.