How to speed up g++ compile time (when using a lot of templates)

后端 未结 10 1242
悲&欢浪女
悲&欢浪女 2020-12-22 18:46

This question is perhaps somehow odd, but how can I speed up g++ compile time? My C++ code heavily uses boost and templates. I already moved as much as possible out of the h

10条回答
  •  没有蜡笔的小新
    2020-12-22 19:19

    Instantiate less templates and inline functions. Precompile as much as you can and just link it rather than compiling everything from scratch. Make sure you're using the latest version of GCC.

    However, it's a simple fact that C++ is an incredibly complex language and compiling it takes quite some time.

提交回复
热议问题