Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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!

share|improve this question

24 Answers 24

up vote 568 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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.0\VC\bin\cvtres.exe

or from VS2012

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe

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

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe

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

Repeat the same steps for 64-bit version of the tool in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cvtres.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).

share|improve this answer

Check the version of cvtrs.exe:

dir "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\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 copy the correct version from:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe

and replace the one here:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe

i.e.

copy "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe"
share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

If you're using x64, here's a resource will help:

This happens because Microsoft .NET 4.5 is incompatible with Visual C++ 10. The workaround is to ensure that you run the .NET version of cvtres.exe rather than the Visual C++ version. I did this by renaming the Visual C++ versions of those files and copying the .NET versions in their place.

1. C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe
2. C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cvtres.exe

1. C:\windows\Microsoft.NET\Framework\v4.0.30319\cvtres.exe
2. C:\windows\Microsoft.NET\Framework64\v4.0.30319\cvtres.exe
share|improve this answer

+1 to user Short for an answer that worked for me!

I tried to do some debugging of this with msbuild /v:diag, and I'm seeing that MSBuild is trying to embed a manifest in the executable, with <somename>.dll.embed.manifest.res on the linker command line, where that is a resource file built from <somename>.dll.embed.manifest. But the manifest file is an empty Unicode text file. (That is, a two-byte file with the Unicode 0xFEFF prefix)

So the root problem seems to have something to do with that manifest file not being generated, or it being used when <somename>.dll.intermediate.manifest should have been used.

An alternate solution seems to be to turn off the "Embed Manifest" option under Properties, Manifest Tool, Input and Output.

share|improve this answer

It didn't work for me after Enable Incremental Linking -> "No (/INCREMENTAL:NO)", but it works for me after I deleted the rc file.

share|improve this answer

As of January 2014, for some reasons I got installed .NET Framework 4.5.1, I don't know if due to a third party software installation or to an automatic update.

On January 29th, I got installed one component and I started receiving the

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

message. At that time, I solved by avoiding the incremental link.

On Jan. 31st, I got installed another component of .NET Framework 4.5.1 and the incremental link trick did not work anymore. I then installed the Visual Studio 2010 SP1, but afterwards the problem became:

Error   6   error LNK1104: cannot open file 'msvcrtd.lib'. 

I think the SP1 messed up my Visual Studio 2010 installation.

So I uninstalled .NET Framework 4.5.1, installed .NET Framework 4.0 and uninstalled and then reinstalled Visual Studio 2010. That worked for me.

share|improve this answer

I tried a few times and finally solved the problem by uninstalling several times the VS2010. I think I hadn't uninstalled all the files and that's why it didn't worked from the first time.

In the installation of VS2012 it is said that if you have VS2010 SP1 you can't work at the same project in both programs. It is recommended to have only one program.

Thanks!

share|improve this answer

I set Enable Incremental Linking to "No (/INCREMENTAL:NO)" and it doesn't work for me.

Next I've changed:

Project Properties 
   -> Configuration Properties 
       -> General
          -> Platform Toolset -> "Visual Studio 2012 (v110)"

and it works for me :)

share|improve this answer

My problem was that I've had two paths on my PC that contained the same libraries. Both paths were added to the Additional Library Directories in Configuration Properties -> Linker -> General. Removing one of the paths solved the problem.

share|improve this answer

Even inspite of installing Service pack you are getting the error then try removing/renaming the cvtres.exe in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin folder. This has worked for me.

share|improve this answer

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

share|improve this answer

I was using the Windows SDK for core Win32 programming and had .NET 4.5 installed for "unknown" reasons. I have uninstalled that and installed 4.0 like previous answers and yeah, it worked for me too.

Just am flabbergasted that I had to use the useless .NET framework for building Win32 apps using the SDK.

share|improve this answer

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.

share|improve this answer

For those of you looking for a solution for this problem with the OpenGL SuperBible 6th source code samples, the solution is building in Release instead of Debug. All projects have disabled the incremental linking option in the Release version.

share|improve this answer

I had the same problem after updating of .NET: I uninstalled the .NET framework first, downloaded visual studio from visualstudio.com and selected "repair".

NET framework were installed automatically with visual studio -> and now it works fine!

share|improve this answer

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

share|improve this answer

protected by Community Jan 29 '13 at 15:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                       <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\n                </div>\n            </div>\n\n            <div id=\"copyright\">\n                site design / logo &#169; 2016 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\n            </div>\n            <div id=\"svnrev\">\n                rev 2016.2.12.3248\n            </div>\n            \n        </div>\n    </div>\n    <noscript>\n        <div id=\"noscript-warning\">Stack Overflow works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\n    </noscript>\n<scr"], "copyright__copyright__copyright": ["Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\cvtres.exe With me, do 3 step it work\n\nshare|improve this answer\n\nprotected by Community Jan 29 '13 at 15:01\n\nThank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.\n\nWould you like to answer one of these unanswered questions instead?\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}