How to make GCC not generate .h.gch files

前端 未结 2 1030
别那么骄傲
别那么骄傲 2021-02-09 07:28

Using GCC to compile C code, GCC automatically generate .h.gch files.

Question

How do I suppress this?

2条回答
  •  醉酒成梦
    2021-02-09 08:28

    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
    

    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.

    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.

提交回复
热议问题