title: What are the implications of using /Zi vs /Z7 for Visual Studio C++ projects?
body: <h2>Background</h2>
  
  <p>There are several different <a href="http://msdn.microsoft.com/en-us/library/958x11bc.aspx" rel="noreferrer">debug flags</a> you can use with the Visual Studio C++ compiler. They are:</p>
  
  <ul>
  <li><strong>(none)</strong>
  
  <ul>
  <li>Create no debugging information</li>
  <li>Faster compilation times</li>
  </ul></li>
  <li><strong>/Z7</strong>
  
  <ul>
  <li>Produce full-symbolic debugging information in the .obj files using CodeView format</li>
  </ul></li>
  <li><strong>/Zi</strong>    
  
  <ul>
  <li>Produce full-symbolic debugging information in a .pdb file for the target using Program Database format. </li>
  <li>Enables support for minimal rebuilds (/Gm) which can reduce the time needed for recompilation.</li>
  </ul></li>
  <li><strong>/ZI</strong>    
  
  <ul>
  <li>Produce debugging information like /Zi except with support for Edit-and-Continue</li>
  </ul></li>
  </ul>
  
  <h2>Issues</h2>
  
  <ul>
  <li><p>The /Gm flag is incompatible with the <a href="http://msdn.microsoft.com/en-us/library/bb385193.aspx" rel="noreferrer">/MP flag for Multiple Process builds</a> (Visual Studio 2005/2008)</p></li>
  <li><p>If you want to enable minimal rebuilds, then the /Zi flag is necessary over the /Z7 flag.</p></li>
  <li><p>If you are going to use the /MP flag, there is seemingly no difference between /Z7 and /Zi looking at MSDN. However, the <a href="http://www.scons.org/doc/production/HTML/scons-user/a4761.html#cv-CCPDBFLAGS" rel="noreferrer">SCons documentation</a> states that you must use /Z7 to support parallel builds.</p></li>
  </ul>
  
  <h2>Questions</h2>
  
  <ul>
  <li><p>What are the implications of using /Zi vs /Z7 in a Visual Studio C++ project? </p></li>
  <li><p>Are there other pros or cons for either of these options that I have missed? </p></li>
  <li><p>Specifically, what is the benefit of a single Program Database format (PDB) file for the target vs multiple CodeView format (.obj) files for each source?</p></li>
  </ul>
  
  <h2>References</h2>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/958x11bc.aspx" rel="noreferrer">MDSN /Z7, /Zi, /ZI (Debug Information Format)</a></p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/bb385193.aspx" rel="noreferrer">MSDN /MP (Build with Multiple Processes)</a></p>
  
  <p><a href="http://www.scons.org/doc/production/HTML/scons-user/a4761.html#cv-CCPDBFLAGS" rel="noreferrer">SCons Construction Variables CCPDBFLAG</a></p>
  
  <p><a href="http://www.debuginfo.com/articles/gendebuginfo.html" rel="noreferrer">Debug Info</a></p>