About fatal error c1083: cannot open precompiled header file:/'debug/v13_3.pch/': Error

Source: Internet
Author: User

This error occurs when compiling the VC program, because this program is not written by myself, and may be caused by the setting of the compiling environment. So this error occurs on my computer (I use the Chinese version of VC IDE)

Fatal error c1083: cannot open precompiled header file:/'debug/v13_3.pch /':

No such file or directory

After collecting the information on the Internet, this error is caused by the Pre-compiled file settings. There are several ways to try:

1) Compile stdafx. cpp separately.

2) compile all (press Ctrl + F7)

3) Remove ×× from the project-set-C ++-bottom project options. PCH File

4) in the project-settings-C ++-select the pre-compiled header file in the category, select automatic use of the pre-compensated header, or choose not to use the pre-compensated Header

Additional knowledge:

To understand the cause of the problem, please first understand the PCH file. refer to the following documents:
Precompiled header file (the general extension is. PCH) is to compile the more stable code in a project in advance and put it in a file (. PCH. these pre-compiled codes can be any C/C ++ code-or even inline functions, but they are relatively stable throughout the project, that is, the code that is not frequently modified during the project development process.

Why do we need to pre-compile the header file? In a word: it increases the compilation speed. generally, the compiler compiles files in units. If a file in a project is modified, all files must be re-compiled, including everything in the header file (eg. macro macro, Preprocessor preprocessing), while in VC programs, the content contained in these header files is often very large, and compilation takes a long time. but they are not often modified, and they are relatively stable. Re-compiling all files of the entire project for a single small file leads to a reduction in compilation efficiency, which is introduced. PCH file.

How to use pre-compiled header files to increase Compilation speed? To use a precompiled header file, you must specify a header file (. h), it contains the code that we do not often modify and other header files, and then use this header file (. h) generate a pre-compiled header file (. PCH) the default header file of VC is stdafx. h. Because the header file cannot be compiled, we still need one. CPP file as a bridge. The default VC file is stdafx. CPP, the only code in this file is: # include "stdafx. H ". use it to generate. the PCH file involves several important pre-compilation commands:/YU,/YC,/Yx,/FP. in short,/YC is used to generate. PCH file compilation switch. in the category of project-> setting-> C/C ++, select the precompiled header for compilation in the Tree View on the left. the. CPP file (default: stdafx. CPP) you can see the/YC switch, which indicates whether the file is generated after compilation. PCH file (possibly/YC c Represents create ). /FP command to specify the generated. the name and path of the PCH file (maybe/FP p represents path ). /Yu's U is used for use, as long as it is included in the project. this/YU command is available for all files in the H file. if you select automatic... the original/YC is replaced with the/Yx command. if Automatic is selected, the compiler will check whether it has been generated before each compilation. PCH file. If yes, it will not be generated. Otherwise, it will be compiled again. PCH file.

Note:
A. In fact, the default header file and CPP file stdafx generated by the appzard Project Wizard. H and stdafx. CPP can be any name. the reason is simple. but if you want to do this, remember to modify the corresponding project-> setting... parameters of several pre-compiled commands (/YC,/YU,/Yx,/FP.
B. it is used in any header file that includes the header file to be precompiled. the start of the project file of the PCH file must be at the beginning. You must include the specified file to be generated. the. h file (Pass. the CPP file is included. The default value is stdafx. CPP), if not included, it will generate the first error. if it is not at the beginning, it will lead to unexpected and inexplicable errors. If you do not believe it, should it be a try?
C. pre-compiled file. PCH generation takes a lot of time, and it also occupies disk space after generation, usually 5-6 M. Note that it is useless to clean up after the project is completed. PCH file to save disk space.
D. if it is lost or deleted. when you need to modify the project file later. CPP file (default: stdafx. CPP) re-compile once to generate again. PCH file. Do not use F7 or rebuild all.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.