您的位置:首页 > 编程语言 > C语言/C++

Microsoft.CppCommon.targets(574,5): error MSB6006: "mt.exe" exited with code 31.解决办法

2014-01-07 16:25 603 查看

一、问题出现

  用VS编译动态库dll文件的时候,ReBuild过程中会遇到Microsoft.CppCommon.targets(574,5): error MSB6006: "mt.exe" exited with code 31.这个问题,略坑爹啊,找了半天都是英文的解决办法,也没解释清楚,于是记录分享。

具体错误如下

1>  Generating code
1>  Finished generating code
1>  myRecast1.vcxproj -> C:\Users\Lufeng\Documents\Visual Studio 2010\Projects\myRecast1\x64\Release\recast.dll
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(574,5): error MSB6006: "mt.exe" exited with code 31.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.57
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


二、解决办法

  设置project的属性Manifest Tool,把 "Embed Manifest" 设置成No,具体操作如图:



  这样就能正常编译了,ReBuild再多次都不会报错了。。

三、问题原因

  具体问题原因如下,和manifest有关。

According to Microsoft's documentation, Mt.exe is "a tool that generates signed files and catalogs". Mt.exe is used in the manifest generation process. If you don't know what a manifest is,further
documentation explains: "A manifest is an XML document that can be an external XML file or a resource embedded inside an application or an assembly. The manifest of an isolated application is used to manage the names and versions of shared side-by-side
assemblies to which the application should bind at run time. The manifest of a side-by-side assembly specifies its dependencies on names, versions, resources, and other assemblies."

  具体翻译就是:根据微软的文档,MT.EXE是“生成签名的文件和目录的工具”。 MT.EXE采用的是清单生成过程。如果你不知道什么是明显的是,更多的文档解释说:“manifest 是一个
XML 文档,可以是外部 XML 文件,也可以是嵌入应用程序或程序集内的资源。isolated
application 的清单用于管理该应用程序在运行时应该绑定到的共享并行程序集的名称和版本。side-by-side
assembly 的清单指定该程序集在名称、版本、资源和其他程序集上的依赖项。“

全文完。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: