15

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

Community
  • 1
  • 1
Kalam
  • 152
  • 1
  • 1
  • 7
  • You are just using the wrong binaries, they were built to be used on VS2013. You'll need the ones that are compatible with VS2012. – Hans Passant Apr 16 '14 at 16:36
  • Do you mean the OSG libraries? It's weird, because i compiled osg libs by myself with the same VS2012, that I'm using now. – Kalam Apr 16 '14 at 16:40
  • Noet that I have VLD working in Release as well. I don't think it's restricted to only work in Debug mode. – Ruud van Gaal Nov 08 '16 at 10:30

1 Answers1

14

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

Bruno Ferreira
  • 1,511
  • 8
  • 17
  • 6
    MSVC2013 Doesn't add the `MSVCR120D.dll`, but only the lib without the "D" in its name. I'll try Dependency Walker and we will see... And as I sad to Hans, I am using OSG libraries that I compiled by myself with the same VS2012... – Kalam Apr 16 '14 at 16:41
  • 10
    the "D" stands for debug information, so one of the libraries must have been compiled for debugging on VS2013. – Bruno Ferreira Apr 16 '14 at 16:44
  • Yea I get it. But its really weird, because I'm compiling such short part of code (added into question), where are only libraries, that I've compiled by myself with the same VS2012. Can I somehow change in cmake/generated project for what version it will create the libraries? After click on the configure button I select the Visual Studio 11, generate project and then I just compile it for debug and release and afterall istall. I thought that this should create project libraries compatible with my version of Visual Studio. – Kalam Apr 16 '14 at 17:59
  • If you used the latest dependency package from OSG, the libraries are compiled on visual studio 2013, so you either need to recompile each library individually or use an older package http://www.osgvisual.org/projects/osgvisual/wiki/Downloads#Dependencies – Bruno Ferreira Apr 16 '14 at 19:30
  • How could I forget 3rPardy libs... Thats it, I downloaded the right 3rdParty libs for VS2012 and it just works. Thaks alot, you saved me. – Kalam Apr 17 '14 at 10:38
  • @BrunoFerreira: Too bad that solution doesn't help when there is no source code available. Can the debug version of that DLL file be obtained from anywhere (except shady third-party sides)? – O. R. Mapper Aug 05 '14 at 07:15
  • 1
    @O.R.Mapper The debug DLLs come only with the respective version of Visual Studio and are not meant to be redistributed (see [this](http://msdn.microsoft.com/en-us/library/aa985618.aspx)) and redistributing these DLLs are against the [EULA](http://www.microsoft.com/en-US/download/details.aspx?id=13350). TL;DR: Download the Visual Studio(C++) Express for that version. – Bruno Ferreira Aug 05 '14 at 19:31