How can you run without "stdfx.h"

In the video, main.cpp is able to run without including “stdfx.h” in visual studio. I though it was absolutely necessary and I am unable to run the code without errors unless I include it.
Also it has to be included before .

So my questions are:

  1. Is it necessary to include “stdafx.h”
  2. Why is/isn’t it necessary?
  3. Why does it have to be included before ?

Quick answers:

  1. No.
  2. Larger projects sometimes use precompiled header files to speed up compilation. You typically won’t see a difference on small projects.
  3. You can delete them from your project. See my post here.

Privacy & Terms