Error 'LINK : fatal error LNK1123: failure dur

2018-12-31 08:08发布

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!

26条回答
看风景的人
2楼-- · 2018-12-31 08:54

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

查看更多
像晚风撩人
3楼-- · 2018-12-31 08:54

I had this problem after I installed Visual Studio 2017 and .NET Framework 4.6 on the machine that previously had Visual Studio 2010.

The problem was that after such an installation the file msvcr100_clr0400.dll from C:\Windows\System32 was overwritten with the new one with a very small size ~19 Kb, however the former one was ~800 Kb.

After I restored the file manually from another build machine cvtres.exe started working properly again.

查看更多
泛滥B
4楼-- · 2018-12-31 08:55

To summarize:

Step1

Project Properties 
   -> Configuration Properties 
       -> Linker (General) 
          -> Enable Incremental Linking -> "No (/INCREMENTAL:NO)"

if step1 not work, do Step2

Project Properties 
   -> Configuration Properties 
       -> Manifest Tool (Input and Output) 
          -> Enable Incremental Linking -> "No"

if step2 not work, do Step3 Copy file one of:

  1. C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe
  2. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cvtres.exe
  3. C:\Program Files (x86)\Microsoft Visual Studio 13.0\VC\bin\cvtres.exe

    Then, replace to C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe With me, do 3 step it work

查看更多
永恒的永恒
5楼-- · 2018-12-31 08:56

I solved this by doing the following:

  1. In a command prompt, type msconfig and press enter.
  2. Click services tab.
  3. Look for "Application Experience" and put tick mark (that is, select this to enable).
  4. Click OK. And restart if necessary.

Thus the problem will go forever. Do build randomly and debug your C++ projects without any disturbance.

查看更多
零度萤火
6楼-- · 2018-12-31 08:59

Reinstalling CMake worked for me. The new copy of CMake figured out that it should use Visual Studio 11 instead of 10.

查看更多
怪性笑人.
7楼-- · 2018-12-31 09:00

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.

查看更多
登录 后发表回答