How to Fix the ‘Failure During Conversion to COFF’ Error in Visual Studio 2012

Failure During Conversion to COFF

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

If you are a developer using Visual Studio 2012, you might have encountered the ‘Failure During Conversion to COFF’ error. This error is caused by the linker, and it prevents you from building your project. In this article, I will explain what the lnk1123 failure during conversion to coff error is, what causes it, and how to fix it.

Introduction to the ‘Failure During Conversion to COFF’ Error in Visual Studio 2012

The ‘Failure During Conversion to COFF’ error occurs when you try to build a project in Visual Studio 2012. The error message you will see is fatal error lnk1123: failure during conversion to coff: file invalid or corrupt. This error message means that the linker was unable to convert the object file format to the COFF format.

The COFF format is the format used by Windows for executable files and dynamic-link libraries. When you build a project in Visual Studio, the linker converts the object files to the COFF format. If the linker encounters an error during this conversion process, you will see the lnk1123 failure during conversion to coff error.

Understanding the Error Messages – lnk1123 failure during conversion to coff

When you encounter the lnk1123 failure during conversion to coff error, you will see the following error message:

link : fatal error lnk1123: failure during conversion to coff: file invalid or corrupt

This error message indicates that the linker was unable to convert the object file format to the COFF format. The file may be invalid or corrupt, or there may be some other issue preventing the conversion process.

Causes of the lnk1123 failure during conversion to coff error

There are several causes of the lnk1123 failure during conversion to coff error. One common cause is a bug in Visual Studio 2012. This bug causes the linker to fail during the conversion process. Another common cause is a problem with the cvtres.exe file. This file is used by the linker to convert the object files to the COFF format. If there is a problem with this file, the linker will fail.

Fixing the Error – Step by Step Guide

There are several solutions to the lnk1123 failure during conversion to coff error. In this section, I will explain each solution in detail.

Solution 1: Updating Visual Studio 2012

One solution to the lnk1123 failure during conversion to coff error is to update Visual Studio 2012. Microsoft has released several updates to Visual Studio 2012 that fix bugs and improve performance. To update Visual Studio 2012, follow these steps:

  1. Open Visual Studio 2012.
  2. Click on the Help menu and select Check for Updates.
  3. Follow the instructions to install any available updates.

After updating Visual Studio 2012, try building your project again to see if the error has been resolved.

Solution 2: Disabling Incremental Linking

Another solution to the lnk1123 failure during conversion to coff error is to disable incremental linking. Incremental linking is a feature that allows the linker to reuse previously generated code. However, this feature can sometimes cause the linker to fail. To disable incremental linking, follow these steps:

  1. Open your project in Visual Studio 2012.
  2. Click on the Project menu and select Properties.
  3. Click on the Linker tab and select General.
  4. Set the Enable Incremental Linking option to No (/INCREMENTAL:NO).
  5. Click on the Apply button to save your changes.

After disabling incremental linking, try building your project again to see if the error has been resolved.

Solution 3: Replacing cvtres.exe

If the cvtres.exe file is causing the lnk1123 failure during conversion to coff error, you can try replacing the file with a working version. To do this, follow these steps:

  1. Locate the cvtres.exe file on your computer. The file is typically located in the following directory: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe
  2. Rename the cvtres.exe file to cvtres.exe.old.
  3. Download a working version of cvtres.exe from the internet. You can search for cvtres.exe on the Microsoft website or on other websites.
  4. Copy the downloaded cvtres.exe file to the C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin directory.
  5. Try building your project again to see if the error has been resolved.

Solution 4: Repairing Visual Studio 2012

If none of the above solutions work, you can try repairing Visual Studio 2012. To repair Visual Studio 2012, follow these steps:

  1. Open the Control Panel on your computer.
  2. Click on Programs and Features.
  3. Locate Microsoft Visual Studio 2012 in the list of installed programs and click on it.
  4. Click on the Change button.
  5. Select the Repair option and follow the instructions to repair Visual Studio 2012.

After repairing Visual Studio 2012, try building your project again to see if the error has been resolved.

Solution 5: Using an alternative linker

If none of the above solutions work, you can try using an alternative linker. There are several alternative linkers available, such as Gold and LLD. To use an alternative linker, follow these steps:

  1. Install the alternative linker on your computer.
  2. Open your project in Visual Studio 2012.
  3. Click on the Project menu and select Properties.
  4. Click on the Linker tab and select Input.
  5. Add the path to the alternative linker’s executable file in the Additional Dependencies field.
  6. Click on the Apply button to save your changes.

After using an alternative linker, try building your project again to see if the error has been resolved.

Solution 6: for Visual Studio 2010

This MSDN thread explains how to fix it.

To summarize:

  • Either disable incremental linking, by going toProject 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.

Conclusion

The lnk1123 failure during conversion to coff error can be frustrating, but there are several solutions available. In this article, I have explained what the error is, what causes it, and how to fix it. If you encounter this error in Visual Studio 2012, try the solutions I have outlined in this article. If none of the solutions work, you can try contacting Microsoft support for further assistance.

Leave a Reply

Your email address will not be published. Required fields are marked *