10

I've built a c++ application with Visual Studio 2012. I've tried to get it to run on another machine without VS2012 installed but it will not run. It keeps looking for msvcr110d.dll (not msvcr110.dll), I have built the application in release mode, and I have my runtime library set for multi-threaded dll (/MD) (although I have tried all of the options with no avail). I have no idea why this isn't running. The target machine does have the redistributable installed. Any suggestions?

Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
GCSM
  • 103
  • 1
  • 1
  • 4
  • Are you sure you have completely re-built the application in release mode, and that the release mode configurations are fine? – SztupY Dec 13 '12 at 01:46
  • Yep, I've rebuilt at least 5 times, and have tried cleaning and rebuilding – GCSM Dec 13 '12 at 02:08
  • Does your project use other libraries? Maybe some of the other ones are using the debug DLL – SztupY Dec 13 '12 at 10:30
  • It's an openGL application using freeglut. Not sure how I would find out if it is using debug dlls – GCSM Dec 13 '12 at 15:31

5 Answers5

5

The d.dll suffix means debug version of C++ runtime DLL. This means your exe is debug build, which requires MSVCR110d.dll.

You should deploy release build of your exe, which requires MSVCR110.dll.

Ask the user to install VC2012 runtime redistributable, MSVCR110.dll will be installed.

linquize
  • 19,828
  • 10
  • 59
  • 83
  • 1
    I am building in release, config manager solution configuration is set to release and same with project – GCSM Dec 13 '12 at 01:38
  • Have you checked whether debug info is enabled even in Release build? – linquize Dec 13 '12 at 01:44
  • It was enabled, I just disabled it and rebuilt and still getting the same error – GCSM Dec 13 '12 at 01:54
  • Are you sure solution config Release refers to project config Release? – linquize Dec 13 '12 at 01:57
  • 1
    Not sure exactly what you mean here. Its the only solution I have open, when I go to Build>Config Manager I see Active solution configuration: Release. And under the project section the project configuration is also set to release. Is that what you mean? – GCSM Dec 13 '12 at 01:59
4

Make sure that not only the solution you're making is built using Release mode configurations, but all dependencies are also using the non-debug DLLs. As you've written you are using imported libraries (freeglut), so check those too. Since freeglut is open-source you might want to built it from scratch too (using release mode), instead of using a pre-built DLL.

SztupY
  • 10,291
  • 8
  • 64
  • 87
  • That would make sense, unfortunately I have no idea how I would even begin to build dlls. This isn't really an issue as I wont be distributing this app, I just needed to test it on one machine. Thanks for the help! – GCSM Dec 14 '12 at 01:44
  • This information was enough for me - thank you! I had a DLL built in Debug mode which wasn't correctly loading because of the msvcr110d.dll. My .exe application was also in Debug mode, but the problem was with the DLL only (coded in C++). – Gobe Jun 25 '15 at 16:18
2

The problem is most likely that freeglut is a debug library, not a release library, and is therefore trying to link against the debug-mode DLL. There probably exists a release-mode version of freeglut as well, and you need to change your project configuration to use that freeglut library instead.

However, there's a deeper issue here: How can you check this for certain? What if there's another library causing the issue, or what if it's some obscure setting in your own executable file? I've found the tool Dependency Walker to be very helpful. Its page claims that it's included with Visual C++, but I couldn't find it in any of my Visual C++ installs (perhaps because I did not install all optional components). Note that the included help file didn't work for me either, but you can view the help file contents on the web page.

freeglut viewed in Dependency Walker

A view of freeglut.dll's dependencies. I've highlighted the particular C Runtime used by this version of FreeGLUT--yours is probably different. The list of functions on the right shows you what MSVCRT exports, and the highlighted ones are the ones that appear to be used. For example, it looks like this version of FreeGLUT uses operator new. If your names are mangled, hit F10 to undecorate the C++ names and see what the functions are. All the missing DLLs appear be "delay-loaded" DLLs (see the hourglass), so they are probably not an issue.

I've used Dependency Walker to figure out a number of nasty DLL issues. While it's perhaps overkill for your particular problem, I think it's nice to know what tools let you actually see the problem, instead of just inferring that it's there.

AHelps
  • 1,782
  • 11
  • 17
0

The quick and easy way is to copy msvcr110d.dll from your development machine to the target machine. Make sure you're using the one from the directory corresponding to the architecture for which your app is built (Windows\System32 or Windows\SysWOW64).

chud
  • 1
  • 1
  • 3
    That's fine as long as it is your own machine, but it is a license violation to distribute the debug runtime to others. – Bo Persson Feb 06 '13 at 19:48
  • Some SDKs from China are still built with VC++ 6.0 debug dll. How do I use that? They should build with release dll. – linquize Apr 04 '13 at 05:25
0

You need to have Visual C++ Redistributable for Visual Studio 2012 installed even if you built Release EXE or DLL and trying to use them on the machine without Visual Studio 2012.

Berezh
  • 942
  • 9
  • 12
  • already installed on my system (x86 and 64) but dll cant be find anywhere. what the hell ? – Phil Mar 28 '18 at 19:34