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

前端 未结 26 2328
误落风尘
误落风尘 2020-11-22 07:45

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 erro

相关标签:
26条回答
  • 2020-11-22 08:10

    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 at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe and one at C:\Windows\Microsoft.NET\Framework\v4.0.30319\cvtres.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.

    Be aware that for x64 tooling builds you may also have to check C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 where there is another cvtres.exe.

    0 讨论(0)
  • 2020-11-22 08:11

    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.

    0 讨论(0)
提交回复
热议问题