安装Visual Studio 2012发行预览版后出现错误“ LINK:致命错误LNK1123:转换为COFF期间失败:文件无效或损坏”

本文翻译自:Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing Visual Studio 2012 Release Preview

I've installed Visual Studio 2012 Release Preview, and it appears to be fine, but now when I try to use Visual Studio 2010 to compile C++ projects, I get the following error message: 我已经安装了Visual Studio 2012 Release Preview,它看起来还不错,但是现在当我尝试使用Visual Studio 2010编译C ++项目时,出现以下错误消息:

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt 链接:致命错误LNK1123:转换为COFF期间失败:文件无效或损坏

I'm not 100% sure of this, but it seems to be related to projects that have .rc (resource) files in them. 我不太确定这一点,但似乎与其中具有.rc (资源)文件的项目有关。

I've tried repairing Visual Studio 2010 from Add/Remove programs and rebooting, but this has no effect. 我尝试过从“添加/删除程序”修复Visual Studio 2010并重新启动,但这无效。

I also get the same error if I use Visual Studio 2012 RC to compile the C++ projects when set to use the Visual Studio 2010 toolset. 如果在设置为使用Visual Studio 2010工具集时使用Visual Studio 2012 RC编译C ++项目,也会遇到相同的错误。 Upgrading to the Visual Studio 2011 toolset fixes the problem (but of course I don't want to do this for production code). 升级到Visual Studio 2011工具集可以解决此问题(但是我当然不想在生产代码中这样做)。

Update: I've uninstalled Visual Studio 2012 , rebooted, and the problem still persists! 更新:我已经卸载了Visual Studio 2012 ,重新启动后,问题仍然存在! Help! 救命!


#1楼

参考:https://stackoom.com/question/jgZD/安装Visual-Studio-发行预览版后出现错误-LINK-致命错误LNK-转换为COFF期间失败-文件无效或损坏


#2楼

I solved this problem eventually by doing a full uninstall of VS2012 RC, followed by a full uninstall of VS2010, then a reinstall from scratch of VS2010. 我最终通过完全卸载VS2012 RC,然后完全卸载VS2010,然后从头重新安装VS2010,解决了此问题。

It took forever, but I'm now able to compile C++ projects in VS2010 again. 花了很长时间,但是现在我可以再次在VS2010中编译C ++项目。


#3楼

This MSDN thread explains how to fix it. 此MSDN线程说明了如何修复它。

To summarize: 总结一下:

  • Either disable incremental linking, by going to 您可以通过以下方法禁用增量链接

     Project Properties -> Configuration Properties -> Linker (General) -> Enable Incremental Linking -> "No (/INCREMENTAL:NO)" 
  • or install VS2010 SP1. 或安装VS2010 SP1。

Edits (@CraigRinger): Note that installing VS 2010 SP1 will remove the 64-bit compilers . 编辑(@CraigRinger):请注意,安装VS 2010 SP1将删除64位编译器 You need to install the VS 2010 SP1 compiler pack to get them back. 您需要安装VS 2010 SP1编译器包才能将其恢复。

This affects Microsoft Windows SDK 7.1 for Windows 7 and .NET 4.0 as well as Visual Studio 2010 . 这会影响用于Windows 7和.NET 4.0的Microsoft Windows SDK 7.1以及Visual Studio 2010


#4楼

I tried a few times and finally solved the problem by uninstalling several times the VS2010. 我尝试了几次,最后通过多次卸载VS2010来解决了问题。 I think I hadn't uninstalled all the files and that's why it didn't work for the first time. 我想我还没有卸载所有文件,这就是为什么它第一次不起作用。

In the installation of VS2012, it is said that if you have VS2010 SP1 you can't work on the same project in both programs. 据说在VS2012的安装中,如果您拥有VS2010 SP1,则无法在两个程序中同时处理同一项目。 It is recommended to have only one program. 建议只有一个程序。

Thanks! 谢谢!


#5楼

It's because of .NET Framework 4.5 is replacing .NET Framework 4.0. 这是因为.NET Framework 4.5取代了.NET Framework 4.0。 I uninstalled Visual Studio 2010 several times with no luck. 我没有好运几次卸载了Visual Studio 2010。 When I removed .NET Framework 4.5 and reinstalled Visual Studio 2010 it went fine. 当我删除.NET Framework 4.5并重新安装Visual Studio 2010时,一切正常。

See Uninstall Visual Studio 11 completely to do a fresh install . 请参阅完全卸载Visual Studio 11进行全新安装


#6楼

If you have installed Visual Studio 2012 RC, then it installed .NET 4.5 RC. 如果您已安装Visual Studio 2012 RC,则它将安装.NET 4.5 RC。

Uninstall .NET 4.5 RC, and install the version you need (4.0 for VS 2010). 卸载.NET 4.5 RC,然后安装所需的版本(VS 2010为4.0)。 This should clear up any problems you are having. 这样可以清除您遇到的所有问题。

This solved the same problem. 这解决了同样的问题。 There is no need to uninstall Visual Studio. 无需卸载Visual Studio。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值