Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt : After installation of VS2012 LNK1123 failure during conversion to COFF

After I have installed VS2012 my Qt project does not compiler anymore (have VS2010 and VS2012 on my computer). Message: LNK1123: failure during conversion to COFF: file invalid or corrupt . It was fine before with VS2010 only.

For the VS2012 environment it is recommended to (see SO here ):

  1. Compile with Enable Incremental Linking NO
  2. Uninstall .net 4.5

Since I am not using Qt in combination with VS2012 (so no plugIn), I cannot setup the project as mentioned. Nor can I uninstall .net 4.5 (needed for another project).

Is there any chance to solve the issue? Some related questions I have

  1. Would it be a solution to compile against VS2012 C++ compiler? Here it says I'd need an own compilation of Qt 5 for this - I would like to avoid such a hassle
  2. Do I need to update Qt?
  3. Or is there a way to simply set Incremental Linking to off as in a VS project? Where in the build settings (screenshot below) would I need to set it?

Win 7, x86 QtCreator 2.5.2 Qt 4.8.1 VS2012 Ultimate with Update 1, VS2010 still installed

Project compile settings

-- Edit ---

I crosschecked, the paths are still to VS2010 and there is no .net 4.5 path included.

Paths

-- Edit 2 -- as of HP's comment

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.

-- One step further --

In my .pro file I am using the following lines to get a DEFINE with the hg version, using this for ages.

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\\\"

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).

Build configs

Checked the hg comment on CMD, seems to be OK.

>P:/Tools/TortoiseHg/hg parents --template '{latesttag}+{latesttagdistance}'
'0.8.902+1'

So why is this leading to the COFF error, and why the messed configurations?. Guess I am getting too old for this crap.

like image 360
Horst Walter Avatar asked Jan 03 '13 13:01

Horst Walter


2 Answers

All credits to ba__friend for the hint. The reason is the wrong cvtres.exe as described here.Disable the old one and all is fine (at least in my particular case).

like image 185
Horst Walter Avatar answered Oct 07 '22 18:10

Horst Walter


I had this issue, in my case the reason was installing Visual Studio 2012 on a machine which already had Visual Studion 2010. I also could not run C++ projects in both Visual Studios (Same error). There are three solutions:

  1. Temporary solution : Use Release mod instead of Debug, Application runs, but no debugging is available.
  2. Download and install Qt MinGW instead of VS version (Twice in size)
  3. (Recommended) Install/Reinstall SP1 of Visual Studio 2010.

Have a nice coding!

like image 41
Behzad Avatar answered Oct 07 '22 18:10

Behzad