您的位置:首页 > 大数据 > 人工智能

LINK1123:failure during conversion to COFF:file invalid or corrupt

2016-06-23 12:00 531 查看
转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=20726500&id=4528320

转注:在原来内容的基础上,增加蓝色字体的英文描述。We just add some blue-font English description.

Summary: Delete or rename cvtres.exe in vs2010’s directory. Here is the directories of this exe:

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

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

下面上转帖者机器上的情况:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\cvtres.exe

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

D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres-not-used.exe

D:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\CVTRES.EXE

原贴内容:

今天用Visual Studio 2010编译一个C工程时突然遇到下面这个编译错误。While building in VS2010, there is an error as below:

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

试了很多方法都没有用,包括微软官方的说明:

Several ways have been tried, including articles by Microsoft:

http://blog.csdn.net/xiaowei_cqu/article/details/18229649

http://fisnikhasani.com/error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-corrupt/

http://msdn.microsoft.com/en-us/library/7dz62kfh.aspx

开始以为自己的项目文件有问题,可以通过编译选项回避,后来新建一个新的空C/C++项目,发现也是相同的问题,知道是VS环境出问题了。

继续调查发现原来是VS用来进行COFF格式转换的工具cvtres.exe被破坏了。

After the compiler options was changed, however, there remains the error. And try to create a new empty C/C++ project, there is also that error. So maybe it’s the problem of VS environment. Further more studying, it’s the transform tool, cvtres.exe, was corrupted.

在命令行下直接执行cvtres.exe,就弹出窗口说进程启动失败。

Run the cvtres.exe under the command line, there will pop up a dialog about error.

而cvtres.exe被破坏的原因是因为我刚装了.Net Framework 4.5,.Net Framework 4.5自带了一个更新的cvtres.exe,却让原来VS2010中的cvtres.exe动不起来了。并且在VS编译时,VS自带的cvtres.exe在PATH环境变量的前面,所以COFF转换失败(不过VS报的错误太误导人了)。

VS2010中的cvtres.exe(已经坏了)

The root cause is: The new installed .Net Framework 4.5 has a newer cvtres.exe. vs2010’s path (refers to the environment variable PATH) is before the .net path. The newer exe cause the original vs2010 exe cann’t work. So COFF failed.

I really don’t understand or assure the root case described above, but after copying a .net exe to vs2010 directory, the COFF error disappeared.

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

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

.Net Framework 4.5安装的cvtres.exe(可以用)

Here is cvtres.exe installed by .Net Framework 4.5:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\cvtres.exe

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\cvtres.exe

知道原因就很好解决了。把VS2010中的两个cvtres.exe删掉或改名字,让VS可以使用.Net Framework 4.5安装的cvtres.exe,就OK了。

So, the solution is: 1. delete or rename the cvtres.exe of vs2010; 2. So let vs2010 use cvtres.exe located in .Net Framework 4.5 installation directory. That’s OK.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  LINK1123 COFF
相关文章推荐