C++ – cannot open source file “stdafx.h”

cvisual c++

I have two include file headers

#include "stdafx.h"
#include "psapi.h"

However it gives a cannot open source file "stdafx.h" compile time error. I am using Visual Studios 2010. Is "stdafx.h" even necessary? I think so because the program cannot compile if i take it away.

Best Answer

Visual Studio uses it for "precompiled headers" feature. If you are not experienced with Visual Studio, I would recommend to keep the stdafx.h in the project.

And of course, if you #include it, you ought to have it.