C++ mt.exe:一般错误 c101008d:无法将更新的清单写入文件资源...访问被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3775406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 13:41:27  来源:igfitidea点击:

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file ... Access is denied

c++visual-studiovisual-studio-2008

提问by Hymanie

I often have this problem even when I build a new C++ project and try to build a release file.

即使我构建一个新的 C++ 项目并尝试构建一个发布文件,我也经常遇到这个问题。

I use Visual studio 2008. One thing that may cause this problem is my code is saved on the server disk, not on local hard disk.

我使用 Visual Studio 2008。可能导致此问题的一件事是我的代码保存在服务器磁盘上,而不是本地硬盘上。

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "..\Release\PGTS_version17C.exe". The process cannot access the file because it is being used by another process.

mt.exe:一般错误 c101008d:无法将更新的清单写入文件“..\Release\PGTS_version17C.exe”的资源。该进程无法访问该文件,因为它正被另一个进程使用。

Anyone know how to solve this? Thanks.

有谁知道如何解决这个问题?谢谢。

回答by Zamboni

If you are embedding a manifest file, your anti-virus program may lock and scan your exe file before embedding the manifest.

如果您要嵌入清单文件,您的防病毒程序可能会在嵌入清单之前锁定并扫描您的 exe 文件。

I recommend disabling anti-virus from reading your DEBUG and RELEASE output folders.

我建议禁用防病毒软件读取您的 DEBUG 和 RELEASE 输出文件夹。

回答by Girardi

Go to Debugand/or Releasefolder(s), right click and unset, recursively, the Read-Only property.

转到Debug和/或Release文件夹,右键单击并递归取消设置只读属性。

Found this tip in the MSDN Communityand solved my problem!

MSDN 社区中找到了这个技巧并解决了我的问题!

回答by Yochai Timmer

It it's not a permissions or actual file access problem (AV)...

这不是权限或实际文件访问问题 (AV)...

You can add a flag to make the compiler check the validity of the manifest.

您可以添加一个标志,让编译器检查清单的有效性。

This validation will fix the problem so you'll never have to rebuild it again.
This is very important for anyone who's running an actual Build-Machine or automatic buildscript where you don't want to manually interfere:

此验证将解决问题,因此您永远不必再次重建它。
这对于运行实际 Build-Machine 或自动构建脚本的任何人来说都非常重要,您不想手动干预:

Add this flag:
Project properties -> Configuration Properties -> Manifest Tool -> Command Line -> Additional options:

添加此标志:
项目属性 -> 配置属性 -> 清单工具 -> 命令行 -> 附加选项:

/validate_manifest

回答by AnyOneElse

Funny enough I had the exact same error and a "rebuild" on the whole project solved it.

有趣的是,我遇到了完全相同的错误,整个项目的“重建”解决了它。

回答by ross

disabling the Anti-Virus worked for me.

禁用反病毒对我有用。

回答by Neilkantha

If you need not generate Manifest file, just set it off it will resolve the problem.

如果您不需要生成 Manifest 文件,只需将其关闭即可解决问题。

Goto Project(right click)

properties

Linker

Manifest Files

Generate Manifest

change it Yes to No

转到项目(右键单击)

特性

链接器

清单文件

生成清单

将其更改为否

It resolve the problem for me on VS2008without disabling Anti-virus. ;)

它在VS2008上为我解决了问题,而无需禁用防病毒。;)

Enjoy :)

享受 :)

回答by RAK

Open visual studio 2010 as "Run as administrator" and Rebuild again.

以“以管理员身份运行”打开 Visual Studio 2010,然后再次重建。

回答by ulatekh

I worked around this with a "wrapper" program for mt.exe, one that reran it until it succeeded. Save the following code as mt-wrapper.cpp:

我用一个“包装器”程序解决了这个问题mt.exe,一个重新运行它直到成功的程序。将以下代码另存为mt-wrapper.cpp

#include <windows.h>
#include <stdio.h>
#include <process.h>

// Build from a Visual Studio Command Prompt with "cl /O2 /Gy /Femt.exe mt-wrapper.cpp"

int __cdecl wmain(int argc, WCHAR **argv, WCHAR **env)
{
    // Stop outputting text.
    fclose(stdout);
    fclose(stderr);

    // Run the original mt.exe, which has been renamed to mt-orig.exe .
    for (;;)
    {
        // Try to run the original mt.
        intptr_t iStatus = _wspawnve(_P_WAIT, L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\mt-orig.exe", argv + 1, env);
        if (iStatus == 0)
            break;

        // Try again, after a short wait.
        ::Sleep(100);
    }

    return 0;
}

Build this program, go to your C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Binfolder, rename the old mt.exeto mt-orig.exe(and the mt.exe.configto mt-orig.exe.config), and put this wrapper program in there as mt.exe. Now, when you build, it will retry running the original mt.exeuntil it succeeds.

构建这个程序,转到你的C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin文件夹,将旧的重命名mt.exemt-orig.exe(和mt.exe.configto mt-orig.exe.config),然后将这个包装程序作为mt.exe. 现在,当您构建时,它将重试运行原始文件,mt.exe直到成功。

Oddly, MSBuild doesn't seem to check for a zero status when deciding that mt.exehas succeeded — it seems to look for error messages written to stdout/stderr. So this program closes both of those before spawning the original mt.exe. Anyone feeling industrious can apply the advice found hereto save the output of the successful run of the original mt.exe, and output it to stdout/stderr.

奇怪的是,MSBuild 在确定mt.exe成功时似乎没有检查零状态——它似乎寻找写入 stdout/stderr 的错误消息。因此,该程序在生成原始mt.exe. 任何觉得勤奋的人都可以应用这里找到的建议来保存原始成功运行的mt.exe输出,并将其输出到 stdout/stderr。

回答by quick nisip

Try this:

尝试这个:

  1. Disable AV
  2. Temporary rename your exe so it doesn't contain any of the words UAC magic words (install, setup, patch, upgrade)
  3. make sure you have write permissions
  4. use mt command to inject the manifest
  5. rename back your exe
  1. 禁用影音
  2. 临时重命名您的 exe,使其不包含任何 UAC 魔法词(安装、设置、补丁、升级)
  3. 确保你有写权限
  4. 使用 mt 命令注入清单
  5. 重命名你的 exe

回答by gd73

I solved this error by stopping and disabling the 'Timing Service' (part of FireEye)

我通过停止和禁用“定时服务”(FireEye 的一部分)解决了这个错误