51

When I try building just a simple program into VS2010, compiling succeeds yet when I try to build the solution it gives me this error:

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

What am I doing wrong?

K..
  • 4,044
  • 6
  • 40
  • 85
user1646690
  • 511
  • 1
  • 4
  • 4
  • 3
    possible duplicate of [LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt after installing VS2012 release preview](http://stackoverflow.com/questions/10888391/link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-c) – Kate Gregory Jan 10 '13 at 00:26
  • 1
    same as this one: http://stackoverflow.com/questions/10888391/link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-c – Steve Wang Jun 06 '13 at 21:57

8 Answers8

69

I had this issue and I solved it with this thread

disable incremental linking, by going to

    Project Properties 
       -> Configuration Properties 
           -> Linker (General) 
              -> Enable Incremental Linking -> "No (/INCREMENTAL:NO)"
Community
  • 1
  • 1
Hamed
  • 2,084
  • 6
  • 22
  • 42
36

This issue occurred after Visual Studio 2012 installation. The issue resolved by replacing the cvtres.exe from VS2010 with the one from VS2012.

Thank you to "social.msdn"!

vikor
  • 361
  • 3
  • 2
  • solved problem for me too. I have new systems with VS 2012. but had to install VS 2010 for compatibility with our work. – JPM Jan 10 '13 at 17:21
  • Works with DLL projects too(didn't see an incremental linking option in project setting there.) The file can be found in "/VC/bin/" for both versions. – akaltar Aug 13 '14 at 20:17
36

I had this issue after installing dotnetframework4.5.
Open path below:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" ( in 64 bits machine)
or
"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin" (in 32 bits machine)
In this path find file cvtres.exe and rename it to cvtres1.exe then compile your project again.

nazanin
  • 478
  • 5
  • 15
  • Thanks, it works. Sadly, the other solution which s installing VS2010 SP1 adds more problems than it solves as : 1- installer enters an infinite loop writing to a temporary HTML file till is larger than 1GB! 2- installer finishes but Vs2010 with SP1 crashes when opening x64 C++ solution! – Mohamed El-Nakeep May 06 '18 at 08:52
  • This works for me. `Windows 7 64 Bit` and `VS 2010 Ultimate`. – Shihab Aug 16 '21 at 19:58
9

Had to install VS 2010 SP1 in order to get it to work again for myself. Lame microsoft.

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
Guest
  • 91
  • 1
  • 1
  • 3
    I did not need to do the incremental linking=NO. I just needed to install SP1. I believe this is a better result, that users apply the update. – macetw Jul 07 '14 at 20:26
  • 1
    Installing 2010 SP1 worked for me also. (The incremental link solution was not relevant to me because I was getting this error even though my projects already had incremental linking disabled.) – M Katz Jun 03 '15 at 02:46
  • This worked for me too and even though I had already installed it but I was still having this error but I assume windows updates has overriding something so re-installing SP1 fixed this issue. – zar Jun 28 '19 at 21:15
7

Do you have Visual Studio 2012 installed as well? If so, 2012 stomps your 2010 IDE, possibly because of compatibility issues with .NET 4.5 and .NET 4.0.

See http://social.msdn.microsoft.com/Forums/da-DK/vssetup/thread/d10adba0-e082-494a-bb16-2bfc039faa80

tterb50
  • 71
  • 1
  • I keep running into this prob. What works on VS2010 does not on VS2012 express. Just taking out VS2012 brilliantly solves. – Ashwin Nov 18 '12 at 03:33
6

I am using Visual Studio 2010.

This happened to me when I installed .NET 4.5. Uninstall of .NET 4.5 and install of .NET 4.0 helped me and error messages disappeared.

tista3
  • 79
  • 1
  • 6
3

If you have installed VS2012 as well, the old cvtres file will no longer work.

Try removing the file (I simply renamed):
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe

You can also debug using the /VERBOSE linker option in order to get more information regarding the linker error. There you should see an error message that the invoke to cvtres fails.

Merav Kochavi
  • 4,223
  • 2
  • 32
  • 37
0

In my case it was just caused because there was not enough space on the disk for cvtres.exe to write the files it had to.

The error was preceded by this line

CVTRES : fatal error CVT1106: cannot write to file
kosnik
  • 2,342
  • 10
  • 23