将光标移到/点击文章中的句子上,可以查看译文。      显示繁体中文内容    显示简体中文内容

Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing Visual Studio 2012 Release Preview
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 :

LINK : fatal error LNK1123 : failure during conversion to COFF :file invalid or corrupt

I'm not 100% sure of this, but it seems to be related to projects that have .rc (resource) files in them.

I've tried repairing Visual Studio 2010 from Add/Remove programs and rebooting, but this has no effect.

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.Upgrading to the Visual Studio 2011 toolset fixes the problem (but of course i don't want to do this for production code).

Update : i've uninstalled Visual Studio 2012, rebooted, and the problem still persists!Help!

时间:

this MSDN thread explains how to fix it.

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.

Edits (@CraigRinger) : Note that installing VS 2010 SP1 will remove the 64-bit compilers.you need to install the vs 2010 SP1 compiler pack to get them back.

This affects Microsoft Windows SDK 7.1 for Windows 7 and. NET 4.0 as well as Visual Studio 2010.

If disabling incremental linking doesn't work for you, and turning off"Embed Manifest"doesn't work either, then search your path for multiple versions of CVTRES.exe.

By debugging with the/VERBOSE linker option i found the linker was writing that error message when it tried to invoke cvtres and it failed.

It turned out that i had two versions of this utility in my path.one atC:Program Files (x86)Microsoft Visual Studio 10.0VCBINcvtres.exeand one atC:WindowsMicrosoft.NETFrameworkv4.0.30319cvtres.exe. after VS2012 install, the VS2010 version of cvtres.exe will no longer work.if that's the first one in your path, and the linker decides it needs to convert a. res file to COFF object format, the link will fail with LNK1123.

(Really annoying that the error message has nothing to do with the actual problem, but that's not unusual for a Microsoft product. )

Just delete/rename the older version of the utility, or re-arrange your PATH variable, so that the version that works comes first.

If you have installed Visual Studio 2012 RC, then it installed. NET 4.5 RC.

Uninstall. NET 4.5 RC, and install the version you need (4.0 for VS 2010 ).this should clear up any problems you are having.

This solved the same problem.there is no need to uninstall Visual Studio.

According to this thread in MSDN forums :VS2012 RC installation breaks VS2010 C++ projects, simply, take cvtres.exe from VS2010 SP1


C:Program Files (x86)Microsoft Visual Studio 10.0VCbincvtres.exe

or from VS2012


C:Program Files (x86)Microsoft Visual Studio 11.0VCbincvtres.exe

and copy it over the cvtres.exe in VS2010 RTM installation (the one without SP1 )


C:Program Files (x86)Microsoft Visual Studio 10.0VCbincvtres.exe

This way, you will effectively use the corrected version of cvtres.exe which is 11.0.511 06.1.

Repeat the same steps for 64-bit version of the tool inC:Program Files (x86)Microsoft Visual Studio 10.0VCbinamd64cvtres.exe

This solution is an alternative to installation of SP1 for VS2010 - in some cases you simply can't install SP1 (i.e.if you need to support pre-SP1 builds).

Go to C:Program Files (x86)Microsoft Visual Studio 10.0 VCbincvtres.exe

and check the version of cvtres.exe :

Wrong version :
date : 03/18/2010
time : 01 :16 PM
size : 31,048 bytes
name : cvtres.exe

Correct version :
date : 02/21/2011
time : 06 :03 PM
size : 31,056 bytes
name : cvtres.exe

If you have wrong version you should go to


C:Program Files (x86)Microsoft Visual Studio 11.0VCbincvtres.exe

and copy cvtres.exe then replace it with


C:Program Files (x86)Microsoft Visual Studio 10.0VCbincvtres.exe

It's because of .NET Framework 4.5 is replacing. NET Framework 4.0.i uninstalled Visual Studio 2010 several times with no luck.when i removed. NET Framework 4.5 and reinstalled Visual Studio 2010 it went fine.

See Uninstall Visual Studio 11 completely to do a fresh install.

For me, setting 'Generate Manifest 'to 'No 'fixed it.(Also fixed with/INCREMENTAL:NO )

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.

It took forever, but i'm now able to compile C++ projects in VS2010 again.

The issue was magically resolved for me by removing .NET 4.5, and replacing it with .NET 4.0.i then had to repair Visual Studio 2010 - it being corrupted along the way somehow.

I had previously installed, and then un-installed, Visual Studio 2012 - which may be related to the issue.

I have not installed Visual Studio 2012, but i still got this error in Visual Studio 2010.i got this resolved after installing Visual Studio 2010 SP1.

...