Qt:安装VS2012后LNK1123在转换为COFF期间失败 [英] Qt : After installation of VS2012 LNK1123 failure during conversion to COFF

查看:38
本文介绍了Qt:安装VS2012后LNK1123在转换为COFF期间失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之后我安装了 VS2012 我的 Qt 项目不再编译(我的电脑上有 VS2010 和 VS2012).消息:LNK1123:转换为 COFF 期间失败:文件无效或损坏.以前只用 VS2010 没问题.

对于 VS2012 环境,建议(参见 ,长期使用.

VERSION = $$system(P:/Tools/TortoiseHg/hg parents --template '{latesttag}+{latesttagdistance}')--- $$system 行似乎是导致 COFF 问题的行,为什么???定义 += VERSION=\\\"$$VERSION\\"

去掉这个,我能够重新编译而不会出现 COFF 错误.但是由于一些混合的 4.8.0/4.8.1 库,应用程序崩溃了.然后我浏览了所有子项目,发现了重复的构建配置.有时我有两次相同的条目,有时丢失.更正了,应用现在可以运行(仍然没有版本标签).

检查了CMD上的hg注释,好像没问题.

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

那么为什么这会导致 COFF 错误,以及为什么会出现混乱的配置?.猜猜我已经老了,不适合这个废话了.

解决方案

所有提示都归功于 ba__friend.原因是这里.禁用旧的,一切都很好(至少在我的特殊情况下).

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

-- Edit ---

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

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

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.

解决方案

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

这篇关于Qt:安装VS2012后LNK1123在转换为COFF期间失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆