[Solved] fatal error C1083: Cannot open included files: “stdafx.h”: No such file or directory

 

1. Error reporting

“Cannot open include file:” StdAfx. H “: no such file or directory”

The error here is that you included the header file # include generated by “StdAfx.h”. Presumably, you created an empty project but included this header file.

2. Solution

Method 1
replace the header file (this method is recommended, which is simpler); The contents of “StdAfx.h” are:

#include < stdio.h>
#include < tchar.h>
just delete your # include “StdAfx.h” here. Replace with what it contains. Namely:

#include < stdio.h>
#include < tchar.h>

method 2:
in your project, find the header file and add a header file named StdAfx.h: After adding successfully, click and add content:

#include < stdio.h>
#include < tchar.h>
save, compile again, and resolve the error~

 

Read More: