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

后端 未结 10 1223
悲&欢浪女
悲&欢浪女 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:21

    If there are a lot of files you can speed up compilation a lot by just having one .cpp file that #includes all the other .cpp files. This of course requires you to be more careful with macros and such that you already have defined per file as they will now be visible to other cpp files.

    If there are many files this can reduce compile time a lot.

提交回复
热议问题