Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the header file written by yourself in the source file in VS2019

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to use the header file written by yourself in the source file in VS2019, I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.

Preface

A complete header file should be divided into .h file and .cpp file.

Generally speaking, the declaration of the function, the definition of the class (structure) are placed in the .h header file, and the implementation of the function is written in the corresponding .cpp file. What corresponding method is that the header file name is the same as the .cpp file name.

The above .cpp file is the source file of C++, or it can be the source file of .cc language.

Include "own header file name" instead of include when referencing the header file written by yourself

< >

This method can only reference system-defined.

Start the tutorial

There should be such a toolbar.

Create a header file

Write the code in the header file in the following format:

/ / Circle_queue header file name # ifndef CIRCLE_QUEUE_H / / is the header file name (all uppercase followed by _ H#define CIRCLE_QUEUE_H code # endif

Write the function declaration and class (structure) definition in the header file

Create the .cpp file corresponding to the header file

The source file name and header file name must be the same

Import the corresponding system header file in this file, as well as the one we created. Then write the implementation of the function declaration in the header file

Used in the rest of its source files

The above is all the contents of the article "how to use the header file you wrote in the source file in VS2019". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report