How do YOU reduce compile time, and linking time for Visual C++ projects (native C++)?

前端 未结 12 1197
深忆病人
深忆病人 2020-11-29 21:46

How do YOU reduce compile time, and linking time for VC++ projects (native C++)?

Please specify if each suggestion applies to debug, release, or both.

12条回答
  •  甜味超标
    2020-11-29 22:22

    It may sound obvious to you, but we try to use forward declarations as much as possible, even if it requires to write out long namespace names the type(s) is/are in:

    // Forward declaration stuff
    namespace plotter { namespace logic { class Plotter; } }
    
    // Real stuff
    namespace plotter {
        namespace samples {
            class Window {
                logic::Plotter * mPlotter;
                // ...
            };
        }
    }
    

    It greatly reduces the time for compiling also on others compilers. Indeed it applies to all configurations :)

提交回复
热议问题