The stdafx.h header is only used when you check the precompiled header checkbox.
In this header you can put your most used headers that you use, for example, you can put the C++ Standard Library headers you are using in your stdafx.h. You can also put your own headers in it that you often use across multiple cpp files.
This stdafx.h will be precompiled by the compiler and this speeds up the compilation process. Note that you should only put headers in stdafx.h that are stable, i.e. that don't change often. More information specific to Visual C++ can be found here: https://msdn.microsoft.com/en-us/library/szfdksca.aspx