如何使GCC不生成.h.gch文件 [英] How to make GCC not generate .h.gch files
问题描述
使用GCC编译C代码,GCC自动生成.h.gch
文件.
Using GCC to compile C code, GCC automatically generate .h.gch
files.
问题
如何抑制这种情况?
推荐答案
以.gch
结尾的文件是预编译的头文件-已进行预编译的头文件,目的是减少(重新)编译主程序时的编译时间
Files ending in .gch
are precompiled headers - header files which have been pre-compiled in order to reduce compilation time when you (re)compile your main program.
如果您以头文件本身为目标调用编译器,则会产生它们,即:
They are produced if you invoke the compiler with the header file itself as the target, ie:
gcc myheader.h
通常,您只会以.c文件为目标来调用编译器.
Normally you would only be calling the compiler with .c files as targets.
如果您不希望它生成预编译的头,则不要以头文件为目标调用编译器.
If you don't want it to produce precompiled headers then don't invoke the compiler with the header files as the target.
如果您不是故意将标头作为目标来调用编译器,则可能是使用了一个makefile,该makefile被设置为生成这些文件,它将具有从.h文件生成.gch文件的规则.您将需要删除这些规则,并调整其他规则以使其不依赖于它们.
If you are not deliberately calling the compiler with the headers as targets, you might be using a makefile which is setup to produce these files - it will have rules in it to produce .gch files from .h files. You will need to remove these rules and adjust other rules not to depend on them.
这篇关于如何使GCC不生成.h.gch文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!