Why use precompiled headers (C/C++)?

后端 未结 5 463
傲寒
傲寒 2020-12-01 01:00

Why use precompiled headers?


Reading the responses, I suspect what I\'ve been doing with them is kind of stupid:

#pragma once

// Defines used         


        
5条回答
  •  难免孤独
    2020-12-01 01:32

    It speeds up compilation.

    When you're including headers from other projects, you don't expect to change them. If you put these into a precompiled header, then that code will not have to be recompiled when you make changes to your source code. This reduces repetitive compilation of unchanged code, speeding up compile time.

提交回复
热议问题