Solution of header file StdAfx. H “no such file or directory” in Visual Studio

1. Stdafx.h is not a standard C++ header file. Here is the default custom file of VS. Used in system precompilation headers. An error like “stdafx.h” : No such file or directory generally occurs, possibly because the compiler cannot create a precompiled file via stdafx.cpp, so other files cannot refer to the PCH file.
Solution: Select the source file stdafx.cpp, right-click -> Property – & gt; C/C++ -> Precompiled headers. The above problem is usually caused by changing the options for precompiled headers from create to use, which can be resolved by changing the options back to create.

Read More: