The program can't start because mfc120ud.dll i

2020-03-24 03:22发布

问题:

I'm trying to run an application that I've recently developped onto another computer and which I've compiled using VS2013.

Running it I get:

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

I've searched the mfc120ud.dll from the net but without any result. I've copied/pasted this dll file from the computer on which I've developed that app onto the system32 of the other computer, doing that implies:

C:\Users\u\System32\mfc120ud.dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.

Knowing that the computer on which I'm developing is a 64-bits one and the other one is 32-bits, and that I've copied/pasted the mfc120ud.dll version from System32, how do I to fix this issue?

回答1:

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

That is one of the debug libraries for MFC. That's the library that you link against when you build debug releases of your program. It is present on your developer machine, but you cannot redistribute it.

You need to do the following:

  1. Build your project for release. This will link against the release versions of any runtime DLLs.
  2. Install the MSVC and MFC redistributable dependencies on any machine on which you plan to run your program. An alternative is to install the runtime DLLs in the same directory as your executable.

I've copied/pasted the mfc120ud.dll version from System32

You are not allowed to do that. Retrace your steps and undo that.



回答2:

Check if you've accidentally defined _DEBUG in your preprocessor definitions.

I once had the same error when I copy pasted settings from the debug build.



回答3:

For me, I build the project using VS2013 xp mode. Then deployed on window XP system. Then I got error that mfc120ud.dll is missing. I installed vcredist.exe for vs2013, which fixed the issue. I am able to run my MFC app.



回答4:

When I encountered a similar problem, first installed the VS 2013 C++ redistributables vcredist_x86.exe and vcredist_x64.exe (https://support.microsoft.com/en-us/help/3138367/update-for-visual-c-2013-and-visual-c-redistributable-package), then I determined what dependencies the file had:

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin>dumpbin.exe /dependents "C:\Temp\MyLibrary.dll"

Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\Temp\MyLibrary.dll

File Type: DLL

  Image has the following dependencies:

    mfc120d.dll
    MSVCR120D.dll
    KERNEL32.dll
    USER32.dll
    OLEAUT32.dll
    mscoree.dll

  Image has the following delay load dependencies:

    MyLibraryCoreD.dll

  Summary

        5000 .data
        2000 .nep
        1000 .pdata
       4E000 .rdata
        1000 .reloc
        1000 .rsrc
       10000 .text

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin>

Next I searched the registry and it did not find mfc120d.dll, only mfc120.dll and mfc120u.dll (see https://serverfault.com/questions/576831/how-do-i-know-if-a-dll-is-registered), so instead of using the debug version I switched to the release version which uses mfc120.dll and the application worked.