You explained that:
[No title] templates / built-in functions ... does not have any implementation details.
Generally speaking, no, adding a header file will not affect the size of the program.
You can check it out. Take the program that is already creating and check the size of the executable file. Then go into each .cpp file and include the standard C or C ++ header file, which is not really needed in this file. Build the program and check the size of the executable file again - it should be the same size as before.
In general, the only things that affect the size of an executable are those that cause the compiler to generate different amounts of code, initialize a global / static variable, or use DLLs / shared libraries. And even then, if any such elements are not needed for the program to work, most modern linkers will drop these things.
Thus, including header files containing only objects such as function prototypes, class / structure definitions without embedded links, and enumeration definitions should not change anything.
However, there are, of course, exceptions. Here are a few.
One of them, if you have an inexperienced linker. Then, if you add a header file that generates things that the program really does not need, and the linker does not throw them away, the size of the executable will be bloated. (Some people intentionally create linkers this way because link time can become insanely fast.)
Many times, adding a header file that adds or modifies the definition of a preprocessor symbol will change what the compiler generates. For example, assert.h (or cassert) defines an assert () macro. If you include the header file in the .c / .cpp file, which changes the definition of the NDEBUG preprocessor symbol, it will change whether assert () will use any code and, therefore, change the size of the executable file.
In addition, adding a header file that changes the compiler options will change the size of the executable file. For example, many compilers allow you to modify the standard "packaging" of structures through something like the line of the #pragma package. Therefore, if you add a header file that changes the packaging structure in the .c / .cpp file, the compiler will create different code to work with the structures and, therefore, change the size of the executable file.
And as someone else remarked, when you are dealing with Visual C ++ / Visual Studio, all bets are disabled. Microsoft has, letโs say, a unique perspective around their development tools that are not used by people writing compiler systems on other platforms.