I wrote a console calculator application in Microsoft Visual C++ Express 2010 and built it as release. It runs fine on my computer but when I moved it to another it said it needed a certain .dll which was not previously, and said reinstalling the application may fix the problem, which it didn't. What did I do wrong?

Dani AI

Generated

Short answer: nothing was wrong with C++ — the target PC is missing the runtime/compatibility your build depends on, or the build itself is not compatible with that machine (wrong configuration or architecture). As hinted, installing the matching Visual C++ runtime package fixes this in most cases, but there are a few quick checks and alternatives worth doing first.

First, find exactly which DLL the error names and confirm the build type. If the missing filename has a trailing "d" it's a Debug CRT (not redistributable) and you must rebuild as Release. Use a dependency tool to inspect your EXE (for example from a VS developer command prompt):

dumpbin /DEPENDENTS MyApp.exe

or open the EXE in Dependency Walker to see which DLLs are required and whether you built for x86 or x64. A 64-bit EXE will not run on 32-bit Windows, so match the target OS.

Fix options (pick one):

  • Install the correct Visual C++ runtime that matches your compiler/version and architecture (the simplest route). This is what recommended.
  • Link the CRT statically (Project → Properties → C/C++ → Code Generation → Runtime Library → choose the multi-threaded static option) so the EXE carries the runtime inside it. Good for small utilities; increases file size.
  • Advanced: side-by-side deployment with manifests can work (as suggested) but is fragile; avoid copying system CRT DLLs into System32 or randomly dropping mismatched DLLs into an app folder without the proper manifest and version match.

Quick checklist: confirm Release build, confirm target platform (Win32 vs x64), inspect dependencies with dumpbin/depends, then either install the matching runtime on the target machine or rebuild with static CRT. These steps will resolve the typical "missing .dll" when moving a VC++ Express-built app to another PC.

Recommended Answers

All 2 Replies

The target machine probably needs the Visual C++ redistributable installed if you are just copying the .exe around. You can find details on deploying Visual C++ apps here.

On 2008 I remember using my own Microsoft.VC90.CRT.manifest files instead of VC++ redistributable installation.
For this you need to get msvcp90.dll and msvcr90.dll. Then you should get info about their version and target architecture. You can get the version number right clicking on the dll file and choosing "Properties". Then you should be able to figure it out. Be sure that both of the files have the same version.
Then you should write in your manifest file:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='{dll version}' processorArchitecture='{dll architecture}' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
  <file name="msvcr90.dll"/>
  <file name="msvcp90.dll"/>
</assembly>

Maybe this will work with 2010 changing Microsoft.VC90.CRT to Microsoft.VC100.CRT and downloading msvcp100.dll and msvcr100.dll? If you want to do it that way, you can try that.

Edit: Oh yeah, try looking in C:/Windows/WinSxS. Look for Microsoft.VC100.CRT files and directories. You should find dlls for your architecture as well as some manifest files you can use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.