windows Visual C++ 可执行文件和缺少 MSVCR100d.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10406807/
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-09-09 09:30:00  来源:igfitidea点击:

Visual C++ executable and missing MSVCR100d.dll

windowsvisual-studio-2010visual-c++msvcrtmsvcr100.dll

提问by mgiuffrida

I know this has been asked in other places and answered, but I'm having issues with MS Visual Studio 2010. I've developed a C++ executable but if I run the Release version on a machine that doesn't have the VC++ runtime library (ie, msvcr100d.dll), I get the "program cannot start because msvcr100d.dll is missing from your computer" error.

我知道这已经在其他地方被问到并得到了回答,但是我在使用 MS Visual Studio 2010 时遇到了问题。我已经开发了一个 C++ 可执行文件,但是如果我在没有 VC++ 运行时库的机器上运行 Release 版本(即,msvcr100d.dll),我收到“程序无法启动,因为您的计算机缺少 msvcr100d.dll”错误。

This is weird for two reasons:

这很奇怪,有两个原因:

  • Why is it trying to link with the debug version of the redistributable?
  • I tried applying this fix, setting the runtime library setting to /MT instead of /MD (multi-threaded DLL), but that only made the problem worse (if I manually copied msvcr100d.dll, it then said it couldn't find msvcp110.dll).
  • 为什么它试图与可再发行组件的调试版本链接?
  • 我尝试应用此修复程序,将运行时库设置设置为 /MT 而不是 /MD(多线程 DLL),但这只会使问题变得更糟(如果我手动复制 msvcr100d.dll,然后它说找不到 msvcp110 .dll)。

How can I package the runtime library with my executable so that I can run it on machines that don't have MS VC 2010 or the redistributable installed?

如何将运行时库与我的可执行文件打包在一起,以便我可以在没有安装 MS VC 2010 或可再发行组件的机器上运行它?

I know it's considered a security risk to include a copy of the DLL since it won't ever be updated, but my goal is just to send this executable to a few friends in the short term.

我知道包含 DLL 的副本被认为是一种安全风险,因为它永远不会更新,但我的目标只是在短期内将此可执行文件发送给几个朋友。

回答by Cody Gray

You definitely should not need the debug version of the CRT if you're compiling in "release" mode. You can tell they're the debug versions of the DLLs because they end with a d.

如果您在“发布”模式下编译,您绝对不需要 CRT 的调试版本。您可以判断它们是 DLL 的调试版本,因为它们以d.

More to the point, the debug version is notredistributable, so it's not as simple as "packaging" it with your executable, or zipping up those DLLs.

更重要的是,调试版本不可再分发,因此它不像将其与可执行文件“打包”或压缩这些 DLL 一样简单。

Check to be sure that you're compiling allcomponents of your application in "release" mode, and that you're linking the correct version of the CRT and any other libraries you use (e.g., MFC, ATL, etc.).

检查以确保您正在“发布”模式下编译应用程序的所有组件,并且您正在链接正确版本的 CRT 和您使用的任何其他库(例如,MFC、ATL 等)。

You will, of course, require msvcr100.dll(note the absence of the dsuffix) and some others if they are not already installed. Direct your friends to download the Visual C++ 2010 Redistributable(or x64), or include this with your application automatically by building an installer.

当然,如果尚未安装,您需要msvcr100.dll(注意没有d后缀)和其他一些。指导您的朋友下载Visual C++ 2010 Redistributable(或x64),或通过构建安装程序将其自动包含在您的应用程序中。

回答by VolAnd

This problem explained in MSDN Libraryand as I understand installing Microsoft's Redistributable Package can help.

这个问题在MSDN Library 中有解释,据我所知,安装 Microsoft 的 Redistributable Package 会有所帮助。

But sometimes the following solution can be used (as developer's side solution):

但有时可以使用以下解决方案(作为开发人员的解决方案):

In your Visual Studio, open Project properties -> Configuration properties -> C/C++ -> Code generationand change option Runtime Libraryto /MTinstead of /MD

在您的 Visual Studio 中,打开Project properties -> Configuration properties -> C/C++ -> Code generation并将选项更改Runtime Library/MT而不是/MD

回答by tmighty

For me the problem appeared in this situation:

对我来说,问题出现在这种情况下:

I installed VS2012 and did not need VS2010 anymore. I wanted to get my computer clean and also removed the VS2010 runtime executables, thinking that no other program would use it. Then I wanted to test my DLL by attaching it to a program (let's call it program X). I got the same error message. I thought that I did something wrong when compiling the DLL. However, the real problem was that I attached the DLL to program X, and program X was compiled in VS2010 with debug info. That is why the error was thrown. I recompiled program X in VS2012, and the error was gone.

我安装了 VS2012,不再需要 VS2010。我想清理我的计算机并删除 VS2010 运行时可执行文件,认为没有其他程序会使用它。然后我想通过将它附加到一个程序来测试我的 DLL(我们称之为程序 X)。我收到了同样的错误信息。我以为我在编译 DLL 时做错了什么。但是,真正的问题是我将 DLL 附加到程序 X,而程序 X 是在 VS2010 中使用调试信息编译的。这就是抛出错误的原因。我在VS2012中重新编译了程序X,错误消失了。

回答by Daniel Bonetti

I got the same error.

我得到了同样的错误。

I was refering a VS2010 DLL in a VS2012 project.

我在 VS2012 项目中引用了 VS2010 DLL。

Just recompiled the DLL on VS2012 and now everything is fine.

刚刚在 VS2012 上重新编译了 DLL,现在一切正常。

回答by SofDev

Debug version of the vc++ library dlls are NOT meant to be redistributed!

vc++ 库 dll 的调试版本不打算重新分发!

Debug versions of an application are not redistributable, and debug versions of the Visual C++ library DLLs are not redistributable. You may deploy debug versions of applications and Visual C++ DLLs only to your other computers, for the sole purpose of debugging and testing the applications on a computer that does not have Visual Studio installed. For more information, see Redistributing Visual C++ Files.

应用程序的调试版本不可再分发,Visual C++ 库 DLL 的调试版本不可再分发。您只能将调试版本的应用程序和 Visual C++ DLL 部署到其他计算机上,其唯一目的是在未安装 Visual Studio 的计算机上调试和测试应用程序。有关更多信息,请参阅重新分发 Visual C++ 文件。

I will provide the link as well : http://msdn.microsoft.com/en-us/library/aa985618.aspx

我也会提供链接:http: //msdn.microsoft.com/en-us/library/aa985618.aspx

回答by Ashutosh kumar

Usually the application that misses the .dll indicates what version you need – if one does not work, simply download the Microsoft visual C++ 2010 x86 or x64 from this link:

通常,缺少 .dll 的应用程序会指示您需要的版本——如果某个版本不起作用,只需从此链接下载 Microsoft Visual C++ 2010 x86 或 x64:

For 32 bit OS:Here

对于 32 位操作系统:这里

For 64 bit OS:Here

对于 64 位操作系统:这里