C ++中的include链如何起作用? [英] How does chain of includes function in C++?

查看:41
本文介绍了C ++中的include链如何起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 在我的 first.cpp 中,放入 #include second.h .
    结果, first.cpp 看到了 second.cpp 的内容.
  • second.cpp 中,我放入#includethird.h .
  • In my first.cpp I put #include second.h.
    As a consequence first.cpp sees the content of second.cpp.
  • In second.cpp I put #include third.h.

我的问题是: first.cpp 会看到 third.cpp 的内容吗?

My question is: will first.cpp see the content of the third.cpp?

添加

我认为,如果我包含second.h,我将能够使用在second.h中声明并在second.cpp中描述(定义,编写)的函数.从这个意义上讲,second.cpp的内容可用于first.cpp

I thought that if I include second.h I will be able to use functions declared in second.h and described (defined, written) in the second.cpp. In this sense the content of the second.cpp becomes available to the first.cpp

推荐答案

您可以将 #include 视为简单的文本插入.但是,如果包含 second.h ,则会看到" second.h ,而不是 second.cpp .

You can think about #include as a simple text insert. But if you include second.h you "see" second.h and not second.cpp.

这篇关于C ++中的include链如何起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆