本文介绍了什么是 .h.gch 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近有一个课堂项目,我必须用 G++ 编写一个程序.

I recently had a class project where I had to make a program with G++.

我使用了一个 makefile,但出于某种原因,它偶尔会留下一个 .h.gch 文件.

I used a makefile and for some reason it occasionally left a .h.gch file behind.

有时,这不会影响编译,但有时它会导致编译器针对已修复或没有意义的问题发出错误.

Sometimes, this didn't affect the compilation, but every so often it would result in the compiler issuing an error for an issue which had been fixed or which did not make sense.

我有两个问题:

1) .h.gch 文件是什么,它的用途是什么?和

1) What is a .h.gch file and what is one used for? and

2) 为什么不清理会出现这样的问题?

2) Why would it cause such problems when it wasn't cleaned up?

推荐答案

.gch 文件是一个预编译的头文件.

A .gch file is a precompiled header.

如果没有找到.gch,则使用正常的头文件.

If a .gch is not found then the normal header files will be used.

但是,如果您的项目设置为生成预编译的标头,则如果它们不存在,它将生成它们并在下一次构建中使用它们.

However, if your project is set to generate pre-compiled headers it will make them if they don’t exist and use them in the next build.

有时 *.h.gch 会损坏或包含过时的信息,因此删除该文件并重新编译应该可以修复它.

Sometimes the *.h.gch will get corrupted or contain outdated information, so deleting that file and compiling it again should fix it.

这篇关于什么是 .h.gch 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 10:49