Hi all, I'm writing a program that calls other programs, that in-turn calls other programs, and I'm concerned about duplicating #include header files. I'm just learning about header files, and I'm particularly interested in the stdafx.h header file because of what it can do. I Googled stdafx.h and got:
1 2 3 4
'stdafx' is just the default name for the 'precompiled header directive'. The headers that are included in stdafx.h are compiled once,
and the information is saved to disk. When a file includes stdafx.h, the compiler just loads the precompiled data instead of
re-parsing all the headers. Typically, more times is spent parsing header files than actually compiling your code, so using
precompiled headers can dramatically speed up your build times.
However, I'm a little confused when writing my own. . . specifically the Header Guards, which I understand is:
1 2 3 4 5 6
#ifndef SOME_UNIQUE_NAME_HERE
#define SOME_UNIQUE_NAME_HERE
// your declarations here
#endif
Since I do not plan to enter any declarations, only #include statements; how do I code for Header Guards, since I plan to enter all of the following #include statements inside of my home-made stdafx.h statement?
were supposed to be the unique name of a header files? Since all this will be going inside the header file *stdafx.h* should THERRY1_UNIQUE_NAME be replaced with stdafx.h, or STDAFX_H?
It really can be anything that you define so that your headers are included only once. I think replacing what I said with STDAFX_H is just fine and dandy!