MSVCP110D.dll 和 Visual Studio 2013

2021-12-31 00:00:00 c++ visual-studio-2013

我正在尝试运行我在 Visual Studio 2013 中编译的程序.但是,我收到错误

I am trying to run a program I compiled in Visual Studio 2013. However, I get the error

The program can't start because MSVCP110D.dll is missing from
your computer. Try reinstalling the program to fix this problem.

这不是一个很有帮助的错误.但是,经过一些谷歌搜索后,我发现它(显然)试图动态加载标准的 c++ 库,为了解决这个问题,我需要指定 /MT选项而不是 /MD 选项.这给我留下了许多问题:

This is not a very helpful error. However, after some Googling, I found that it is (apparently) trying to load a standard c++ library dynamically, and that to get around this I need to specify the /MT option rather than the /MD option. This leaves me with a number of questions:

  1. 那到底在做什么?
  2. /MD 相对于 /MT 有什么好处?我的意思是,它是默认选项肯定是有原因的...
  3. 我将如何寻找 .dll 并让 Visual Studio 使用它?我下载了这个,但老实说不知道究竟如何使用它.
  4. 最重要的是,如何消除该错误并运行我的程序?
  1. What exactly is that doing?
  2. What are the benefits of /MD as opposed to /MT? I mean, there must be a reason that it is the default options...
  3. How would I go about getting the looked for .dll and getting Visual Studio to use it? I downloaded this, but honestly don't know exactly how to use it.
  4. Most importantly, how to I get that error to go away and my program to run?

一些附加信息:我正在使用 x64 构建在 Release 模式下进行编译.

Some additional info: I am compiling in Release mode using an x64 build.

推荐答案

问题是您正在使用使用不同编译器编译的 Qt 混合不同版本的 Visual Studio.请记住,每个版本的 Visual Studio 都有自己的运行时/CRT.使用 Visual Studio 2012 编译的 Qt dll 将依赖于 Visual Studio 2012 运行时.他们不会使用 2013 运行时.

The problem is that you are mixing different versions of Visual Studio by using Qt that was compiled using a different compiler. Remember that each version of Visual Studio will have its own runtime/CRT. The Qt dlls that were compiled with Visual Studio 2012 and will be dependent on the Visual Studio 2012 runtime. They will not use the 2013 runtime.

此问题的解决方案是使用相同的编译器重新编译所有代码和相关库/dll.

The solution to this problem is to recompile all of your code and dependent libraries/dlls with the same compiler.

警告:一些用户会尝试从其他版本的 Visual Studio 安装动态运行时(或使用静态 CRT 重新编译依赖库),但这不是解决此问题的主要方法,主要是因为每个运行时都有自己独立的堆.拥有单独的堆会导致随机崩溃,因为在一个堆中分配内存,然后尝试在不同的堆中释放它.由于堆不共享有关分配或释放的信息,这会导致堆损坏.根据我的经验,问题并不总是会导致立即崩溃.崩溃可能会也可能不会发生在损坏堆的下一次分配中,因此调试这种情况可能会非常令人沮丧.

Warning: Some users will try to just install the dynamic runtime (or recompile dependent libraries with static CRT) from the other version of Visual Studio however this is not a solution to this problem mainly because each runtime has its own independent heap. Having separate heaps can and will lead to random crashes caused by allocating memory in one heap and then trying to free it in a different heap. Since the heaps do not share information about allocations or deallocations this leads to having corrupt heaps. From my experience the problem does not always cause an instant crash. The crash may or may not happen on the next allocation of the corrupt heap so debugging this situation can be very frustrating.

相关文章