Qt what headers to include?

前端 未结 4 1446
我在风中等你
我在风中等你 2021-02-20 11:42

While programming in C++ with Qt what includes should I make? Just 2 includes

#include 
#include 

or



        
4条回答
  •  死守一世寂寞
    2021-02-20 12:06

    Just include what you need in your classes to speed up compiling. If you're one of the lazy guys and don't matter how long it takes to compile, pick the more generic headers but avoid them if you're looking for optimization (the compiler/linker will most likely remove unused stuff but it's still better to not include it first).

    In general I only include new stuff if I need something that's still missing (i.e. not included yet). So, just hit compile. If it's missing something you forgot, add the header. If you don't like that approach, use the generic headers you mentioned.

提交回复
热议问题