I. Solution
Right-click the project you created, select "Property tag", and click Properties. The "project property page" is displayed ", on the left side, locate the following position to configure properties --> C/C ++ --> pre-compilation header and select it: in the menu on the right, select "do not use precompiled header file" in "Create/use precompiled header file" and click "OK" to exit.
Ii. Cause Analysis
Generally, compilers compile files in units. If a file in the project is modified, all files will be re-compiled, which takes a long time.
To increase Compilation speed, the files that are not often modified and are relatively stable are separately included in a specified header file, and a pre-compiled header file *. PCH is generated. The default header file in VC is stdafx. h, but only header files cannot be compiled, so stdafx is also used. CPP contains only one valid Code. In this way, stdafx is compiled. CPP compiles most system header files, and a pre-compilation information is generated under the DEBUG directory *. PCH file.
If the *. PCH file is damaged or does not exist, an error occurs, indicating that the pre-compiled header file cannot be opened.
3. self-understanding and ideas
The Cause Analysis is in place, but the online solution (for example) is not very good. In my understanding, since the *. PCH file is to be generated, let the program generate one. In case it will be used later, it can save time.
So my approach is in stdafx. in the CPP attribute, select create pre-compiled header file, and then F7 to compile stdafx. CPP file to generate *. PCH file, and then compile main. CPP file.
Fatal error c1083: Unable to open the pre-compiled header file: "Debug \ A. PCH": no such file or directory