VS2012 MSVCR120D.dll is missing

2020-02-25 09:02发布

问题:

I am trying to set up my project in VS2012 to successfully compile and run an OSG code for debugging. I am also using OSG debug libraries. Compilation and linking end successfully but after I run the binary I get an error saying that MSVCR120D.dll is missing.

I was looking for a solution to this error the whole day and it doesn't make sense to me, because I am using VS2012 that should use MSVCR110D.dll. I also don't have this dll in C:\Windows\System32, there's only MSVCR120.dll and its older versions.

If I try to compile the project in release mode using non-debug osg libraries everything is fine and I can normally run the project without errors.

Referring to this question I was trying to play with MFC and Runtime Library settings but only release libraries work at all.

I need to run it with debug libraries because I want to use Visual Leak Detector that doesn't work with release libraries. This is part of the code I'm using (OSG libs are compiled with the same VS2012).

#include "stdafx.h"
#include <windows.h>

// osg libs
#include <osgViewer/Viewer>

int main(int argc, char **argv) {
  osgViewer::Viewer viewer;
  while (!viewer.done()) {
    viewer.frame();
  }
  return 0;
}

Here are screenshots of the settings of my project that causes the error:

General settings of project C/C++ Code Generation submenu

回答1:

At least one of the libraries you are using is compiled using VC12(2013), so either recompile them (you may see which library is compiled on VC12 using Dependency Walker or install the MSVC 2013 redistributables download from here