简体   繁体   English

编译器是否编译 C++ 中的 header 文件?

[英]Does compiler compiles header files in C++?

like these are two headers files, now does compiler compiles these?像这些是两个头文件,现在编译器会编译这些吗?

#include<iostream.h>
#include<conio.h>

When any file is included with an #include directive, the compiler processes its contents as if it were part of the source file being compiled#include指令包含任何文件时,编译器会处理其内容,就像它是正在编译的源文件的一部分一样

actually it depends.实际上这取决于。

#include mean that: hey compiler would you please copy content of that file inside this file(in preprocessing stage). #include的意思是:嘿编译器,请您将该文件的内容复制到该文件中(在预处理阶段)。 after compiler copied content to given file then it will go for compiler now it depends.在编译器将内容复制到给定文件之后,它将 go 用于编译器,现在取决于它。 most compiler by default compiler compile given c++ files but other external functions and classes(for example stl and other third party libraries that not yours) will be find during run(which is dynamic library) the other side of dynamic library is static library which is instead of compiler compile specific files it goes for your dependencies and compile them along your code and put them together in this case programme does not need to find libraries during run which is why i said it depend.大多数编译器默认编译器编译给定 c++ 文件,但其他外部函数和类(例如 stl 和其他不属于您的第三方库)将在运行期间找到(这是动态库)动态库的另一端是 ZA81259CEF8E959C624DF1D4 库而不是编译器编译特定文件,而是为您的依赖项编译它们并沿着您的代码编译它们并将它们放在一起,在这种情况下程序不需要在运行期间找到库,这就是我说它依赖的原因。

more information about compiler stages here .有关编译器阶段的更多信息,请点击此处

more information about dynamic library and stl and dynamic library here .有关动态库和 stl 和动态库的更多信息,请点击此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UBUNTU C ++编译器无法查找头文件 - UBUNTU C++ compiler not finding header files 使用 C 编译器在 C 头文件中添加 c++ 头文件? - To add c++ header files in C header using C compiler? C / C ++编译器如何在头文件中找到原型的定义? - How does a C/C++ compiler find the definitions of prototypes in header files? 每次编译该程序时,编译器是否会编译所有包含的头文件以及主程序? - Does compiler compiles all included header files along with the main program every time we compile that program? C ++编译器(或Linker?)如何知道如何处理cpp和标头类文件? - How does the C++ compiler (or Linker?) knows how to handle cpp and header class files? C ++模板函数在头文件中编译但不实现 - C++ template function compiles in header but not implementation 在Windows上编译MinGW的C ++程序是否适用于Linux上的GNU编译器? - Will a C++ program that compiles for MinGW on Windows work for GNU compiler on Linux? 我的Visual C ++编译器编译过时的源代码 - My Visual C++ compiler compiles out of date source C ++ Visual Studio编译器将本地代码编译为托管 - C++ Visual Studio Compiler compiles native code as managed 为什么Visual C ++编译器将未使用的类编译为可执行文件? - Why Visual C++ compiler compiles unused classes into executable?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM