fatal error C1083: Cannot open include file: "afx.h": No such file or directory

  When opening a project with Visual Studio 2017 for compilation, the following error was reported:

fatal error C1083: Cannot open include file: "afx.h": No such file or directory

  The reason is that the MFC component is not installed, and MFC may not be checked during installation.

1. The solution is to open the Visual Studio Installer, choose to modify,

Insert picture description here

2. Select C++ desktop development, check the Visual C++ MFC for x86 and x64 on the right,

3. Click Modify in the lower right corner and wait patiently for the installation to complete.

Insert picture description here

4. Finally restart VS and find that the compilation is passed and you are done.

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_34430371/article/details/110926982