title: Qt : After installation of VS2012 LNK1123 failure during conversion to COFF
body: <p><strong>After</strong> I have installed <strong>VS2012</strong> my Qt project does not compiler anymore (have VS2010 and VS2012 on my computer). Message: <code>LNK1123: failure during conversion to COFF: file invalid or corrupt</code> . It was fine before with VS2010 only.</p>
  
  <p>For the VS2012 environment it is recommended to (see <a href="https://stackoverflow.com/questions/10888391/link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-c">SO here</a> ):</p>
  
  <ol>
  <li>Compile with <code>Enable Incremental Linking NO</code></li>
  <li>Uninstall .net 4.5</li>
  </ol>
  
  <p>Since I am not using Qt in combination with VS2012 (so no plugIn), I cannot <a href="https://stackoverflow.com/a/10890428/356726">setup the project as mentioned</a>. Nor can I uninstall .net 4.5 (needed for another project).</p>
  
  <p><strong>Is there any chance to solve the issue?</strong> Some related questions I have</p>
  
  <ol>
  <li>Would it be a solution to compile against VS2012 C++ compiler? <a href="https://stackoverflow.com/questions/13969146/how-to-use-qt5-and-qt-creator-2-6-1-with-compiler-from-vs-2012">Here it says</a> I'd need an own compilation of Qt 5 for this - I would like to avoid such a hassle </li>
  <li>Do I need to update Qt?</li>
  <li>Or is there a way to simply set <code>Incremental Linking to off</code> as in a VS project? Where in the build settings (screenshot below) would I need to set it?</li>
  </ol>
  
  <p>Win 7, x86
  QtCreator 2.5.2
  Qt 4.8.1
  VS2012 Ultimate with Update 1, VS2010 still installed</p>
  
  <p><img src="https://i.stack.imgur.com/UI0gu.png" alt="Project compile settings"></p>
  
  <p>-- Edit ---</p>
  
  <p>I crosschecked, the paths are still to VS2010 and there is no .net 4.5 path included.</p>
  
  <p><img src="https://i.stack.imgur.com/2Tbfp.png" alt="Paths"></p>
  
  <p>-- Edit 2 -- as of HP's comment</p>
  
  <p>At least I have tried with my Anti Virus Software off. Same issue. 
  Furthermore I have checked some other smaller Qt projects (I am a sporadic Qt coder, so I do not have plenty of experience in that field). They do compile. Also all my sub projects in the affected Qt project do compile, only the last part (GUI, using all of the sub projects) fails with the above error. </p>
  
  <p>-- One step further --</p>
  
  <p>In my <code>.pro</code> file I am using the following lines to get a <code>DEFINE</code> <a href="https://stackoverflow.com/questions/10550071/qt-automatically-adding-version-for-application">with the hg version</a>, using this for ages.</p>
  
  <pre><code>VERSION = $$system(P:/Tools/TortoiseHg/hg parents --template '{latesttag}+{latesttagdistance}')
  --- $$system line seems to be the line causing the COFF issue, WHY???
  DEFINES += VERSION=\\\"$$VERSION\\\"
  </code></pre>
  
  <p>Taking this out, I was able to recompile without the COFF error. But the application crashed due to some mixed 4.8.0 / 4.8.1 libs. Then I went through all sub projects and found duplicated build configurations. Sometimes I had the same entries twice, sometimes missing. Corrected them, app runs now (still without the version tag).</p>
  
  <p><img src="https://i.stack.imgur.com/Ck34G.png" alt="Build configs"></p>
  
  <p>Checked the hg comment on <code>CMD</code>, seems to be OK.</p>
  
  <pre><code>&gt;P:/Tools/TortoiseHg/hg parents --template '{latesttag}+{latesttagdistance}'
  '0.8.902+1'
  </code></pre>
  
  <p><strong>So why is this leading to the COFF error, and why the messed configurations?</strong>. Guess I am getting too old for this crap.</p>