My question is on proper syntax and usage of header guards. For example if I am including a few common libraries in my C++ code can I make a header guard like what is shown below? Also, from the documentation I could find on header files it was suggested to put your header guard in a header file. I am using Microsoft Visual Studio. Can I just place my header guard and #include files in my main source file? Or is this a bad practice? I know you can use #pragma to function as a header guard. However, this is not a supported standard so I am trying to avoid using it.
#ifndef HEADER_GUARD
#define HEADER_GUARD
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#endif
Any help would be greatly appreciated!