Fatal error c1853 occurs when the. c file is mixed in the vc6.0 compiler. Solution

Source: Internet
Author: User

In chapter 1, sample1CodeBasicallyC LanguageTherefore, the CPP file in the new job should be changed to the C file.

 

However, the error fatal error c1853: "Debug/release 1.pch" is not a precomplied header file with this complier ......

 

What should I do if this is the first time I encountered this problem? Baidu, the solution is as follows:

 

Error cause:

This error occurs because the project is mixed. CPP and. c files, the compiler will adopt different compilation methods for them (mainly because the processing methods for function declaration are different), and thus cannot share a precompiled header file.

 

In VC ++, the default pre-compiled header file is for C ++ (stdafx. h and stdafx. cpp). Of course, you can also create a pre-compiled header for C. Interestingly, in earlier versions of VC ++, the error message is misleading: Fatal error c1853: 'xxx. pch' is not a precompiled header file created with this compiler. it is often confusing. It should be said that this prompt in the new version has been improved. However, when searching online, we recommend that you cancel the pre-compilation header settings for the entire project. This is obviously not a good solution. For a large project, the use of the pre-compilation header can greatly reduce the total Compilation Time. Therefore, it is better to retain the pre-compiled header settings. Search
Msdn provides different solutions for different situations:

 

Solution 1: Applicable to the case where the vast majority of files are. cpp or the vast majority of files are. C. In this case, it is more balanced to set a few different types of files to not use the pre-compiled header by: for VC ++ 6.0, in FileView. C (or. CPP) Right-click the file and select Settings. In the displayed dialog box, set category to precompiled headers, and set the option not using ...; for vs2005
Right-click the corresponding file in Explorer and select Properties. Set not using... under precompiled headers. If you need to set multiple files, you can press and hold the ctrl key to select these files and set them.

 

Solution 2: If many affected files are affected, setting all of them to disable the pre-compilation header will greatly reduce the overall compilation speed of the project, which is worth the candle. In this case, you can create a special pre-compilation header for this set of files. In the early versions of VC ++ (1.5 and earlier versions), It is supported to create a separate target for a single project. C and. CPP pre-compilation header, but later versions only support separate pre-compilation headers. In this case, we can create a new static library project in workspace (or solution ),
The. c file is independently added to the project for separate compilation, so that you can create a pre-compilation header for the. c file in the static Link Library. However, to a certain extent, the Code independently belongs to the same module logically to facilitate maintenance. However, from the design perspective, this requirement is generally met. Otherwise, we should consider the overall design of the project: P. Finally, don't forget to set the dependency of the original project) is a separate static library project.

 

 

I am using solution 1, because I have a small amount of work, simple windows consloe Application

Related Article

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.