[Solved] LINK : fatal error LNK1123: failure during conversion to COFF: file

This error is familiar to people who often write C++, so I looked for this error. There are several general solutions on the Internet:

disable incremental linking

Project Properties -> Configuration Properties -> Linker (General) -> Enable Incremental Linking -> “No (/INCREMENTAL:NO)”
turning off “Embed Manifest”

This is used in the project settings of the vs solution. But I am using CMake now, what’s the matter? Keep looking. . . Finally, I found the answer on Stackoverflow:

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. 

In other words, there are two cvtres.exe in the system, located in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe and C:\Windows\Microsoft.NET\Framework\v4. 0.30319\cvtres.exe. If you use the program under the first path, there will be problems (don’t know the specific reason, is it a bug in vs2010?), if you use the second path, there is no problem. Therefore, the simplest solution is to delete or rename the cvtres under the first path, and let CMake directly use the cvtres under the second path.

Similar Posts: