问题描述
我想了解外部链接和内部链接及其差异。
我也想知道
的意义
.cpp , .cxx
等),您的编译器会生成翻译单元。这是你的实现文件中的目标文件加上你 #include
d中的所有头。
内部链接仅指翻译单位范围内的所有内容。
外部链接是指存在于特定翻译单元之外的内容。换句话说,可通过整个程序访问,这是所有翻译单元(或对象文件)的组合。
I want to understand the external linkage and internal linkage and their difference.
I also want to know the meaning of
When you write an implementation file (.cpp
, .cxx
, etc) your compiler generates a translation unit. This is the object file from your implementation file plus all the headers you #include
d in it.
Internal linkage refers to everything only in scope of a translation unit.
External linkage refers to things that exist beyond a particular translation unit. In other words, accessible through the whole program, which is the combination of all translation units (or object files).
这篇关于什么是C ++中的外部链接和内部链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!