@chevchelios , the first stage of C / C ++ compilation is the work of the preprocessor.
It reads the specified file with the program, executes directives starting with the #
character ( #define
, #include
, etc.) and makes text macro substitutions (replaces (roughly speaking) the text in the program with the text defined in #define
directives)
Those. the preprocessor changes the TEXT of the program, without particularly delving into its meaning. The #include
directive says that instead of the line with it, you need to insert the lines of the specified file (recursively).
If you run gcc -E prog.c or g ++ -E prog.cpp, you will see how the text of your program has changed. It is placed in a temporary file (or directly (by pipe) passed to the compiler). It is this text that is processed by the compiler that produces the object module .
Regarding developers and solving the problem of duplication She successfully solved. "Programmer" reported on his mistakes.
Header
files withoutinclude guards
not needed by anyone. - By itself, the question about "samples" of headers suggests that you are not well versed in the stages of the compiler and linker. That is, roughly speaking, if you understand them, then such a question simply will not arise :) - Costantino Rupert