MSVCR80D.dll not found 没有找到MSVCR80D.dll

来源:互联网 发布:dnf玩着玩着网络中断 编辑:程序博客网 时间:2024/04/25 11:55
I ran in to this couple of days back.
Visual Studio 2005 threw up the following error message when i ran my CRT Win32/Console application in Debug mode.
---------------------------
<App Name> - Unable To Locate Component
---------------------------
This application has failed to start because MSVCR80D.dll was not found. Re-installing the application may fix this problem.
---------------------------
OK  
---------------------------
The app ran fine in Release mode though.
(BTW, The error message, the title and the OK were automatically generated!! we can 'copy' the entire content of a error dialog by pressing CTRL-C when the dlg is active)
The most interesting/worrying aspects of this were the facts that this application is a 'straight-from-the-wizard' application and that the app worked sporadically on repeated trials of clean-and-rebuild project. Repeated attempts of install/reinstall/repair didn't fix this.
Searching the net for similar issues led me to this http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=15218
So, according to the posts, the issue was due to a missing manifest file. But i was able to see two manifest files in the debug folder. In fact there are 2 debug folders. 1 in the <solution folder>/debug and the other <solution folder>/<project folder>/debug. The <solution>/debug contains the final output file and the <solution>/<project>/debug contains intermediate files. The .manifest files are present in the inner debug folder. I copied the '.embed.manifest' file to the outer debug folder and renamed it to <app name>.manifest. The app ran fine now. However, the fact that I had to manually do this meant that there was something wrong with this.
I started fiddling around with the project options and found that there is an option to ensure that the manifest is not embedded and its created externally. The setting is found in 'Project Properties->Configuration Properties->Mainfest Tool->Input and Output->Embed Manifest'. This is set to 'YES' by default. When this is set to NO the manifest is created in the outer debug directory and the app runs fine. Interestingly the app runs fine in the release version even when the manifest is embedded.
Resolution : Either of the following would fix this
1) Copy the <appname>.exe.embed.manifest from the inner debug folder to the outer debug folder and rename it to <appname>.exe.manifest. This is more of a hack. To ensure consistency between the executable and the manifest the manifest has to be copied everytime it can change. Use this reolution only when you specifically want an embedded manifest. ( setup a command line in the post build options to do this)
2)  Set the 'Embed Manifest' option to 'NO' for the debug version. (This would mean when you move(or ship) your debug executable to some other machine you have to move(or ship) the manifest file also.)

As of now, This looks like some sort of a bug in the creation of a debug executable with embedded manifest. I will update here if get to know something more.
******************
另给出其他解决方法
This means several things.
a) your console application does not have manifest. Either embedded inside or external. To check this, do the following:
      `1. Check for <appname>.exe. manifest next to exe. If it is not there, it may be embedded. Go to step 2.
        2. Open appname.exe in VS. See if it has RT_MANIFEST. Save it as a file and see if it has this line in it:      
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50215.4652" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
            If no RT_MANIFEST resource is present in the binary, go to step 3. If it is there, then go to step 4.
         3. You are building with /manifest:no. Don't do this, it is not supported scenario. Remove this linker switch and it all should work.
         4. msvcr80d.dll is not on the system. We need to know what version of VS is installed, what OS, what parts of VC++ have you selected during installations. Go ahead and file a bug on this on lab.msdn.microsoft.com.
******************
开始之前,确认:
1.
安装完成Visual Studio 2005,确认安装的时候选中了Unicode MFC version以及CRT source code(默认是选中的,如果你没有改动的话那么应该是装上了的);
2.
找到我们要动手术的目录,在$(Program Files)/Microsoft Visual Studio 8/VC 下,找出ATLMFC/SRCCRT/SRC两个文件夹;
3.
(可选)安装Platform SDK,复制最新版本的unicows.lib放到VC/PlatformSDK/LIB中。VC8自带有unicows.lib,所以这一步可以不做。
一:编译MSLUCRT8.0
首先请备份一下VC/LibVC/CRT/SRCVC/ATLMFC/SRCVC/ATLMFC/lib这四个文件夹(包括子文件夹),假如不小心改错的话可以直接从备份的文件夹里复制文件出来。
CRT
库需要编译的是这6DLLMSVCR80.DLLMSVCP80.DLLMSVCM80.DLLMSVCR80D.DLLMSVCP80D.DLLMSVCM80D.DLL。为方便操作,我们把将要输出的MSLUCRT库文件改为别的名字以免和原来的混淆,分别改成:MSLUR80.DLLMSLUR80D.DLLMSLUP80.DLLMSLUP80D.DLLMSLUM80.DLLMSLUM80D.DLL(如果你改成别的名字的话,后面的操作请做相应的改正)。
1)先把SRC目录下的相应文件改名:
copy _SAMPLE_.RC MSLUR80.RC
copy SAMPLE_P.RC MSLUP80.RC
copy SAMPLE_M.RC MSLUM80.RC
copy SAMPLE_P.DEF MSLUP80.DEF
copy SAMPLD_P.DEF MSLUP80D.DEF
copy SAMPLE_M.DEF MSLUM80.DEF
copy SAMPLD_M.DEF MSLUM80D.DEF
copy SAMPLE_U.DEF MSLUU80.DEF
copy SAMPLD_U.DEF MSLUU80D.DEF
copy Intel/_SAMPLE_.DEF Intel/MSLUR80.DEF
copy Intel/_SAMPLD_.DEF Intel/MSLUR80D.DEF
2)打开MSLUP80.DEF,修改LIBRARY SAMPLE_PLIBRARY MSLUP80
打开MSLUP80D.DEF,修改LIBRARY SAMPLD_PLIBRARY MSLUP80D
打开MSLUM80.DEF,修改LIBRARY SAMPLE_MLIBRARY MSLUM80
打开MSLUM80D.DEF,修改LIBRARY SAMPLD_MLIBRARY MSLUM80D
打开MSLUU80.DEF,修改LIBRARY SAMPLE_MLIBRARY MSLUM80;(注意此处不是MSLUU80而是MSLUM80
打开MSLUU80D.DEF,修改LIBRARY SAMPLD_MLIBRARY MSLUM80D;(注意此处不是MSLUU80D而是MSLUM80D
打开/Intel/MSLUR80.DEF,修改LIBRARY _SAMPLE_LIBRARY MSLUR80
打开/Intel/MSLUR80D.DEF,修改LIBRARY _SAMPLD_LIBRARY MSLUR80D
3)打开SRC/makefile文件,修改开头部分为:
RETAIL_DLL_NAME=MSLUR80
RETAIL_DLL_NAME=MSLUR80
RETAIL_LIB_NAME=MSLUR80
RETAIL_DLLCPP_NAME=MSLUP80
RETAIL_LIBCPP_NAME=MSLUP80
RETAIL_DLLMIXED_NAME=MSLUM80
RETAIL_LIBMIXED_NAME=MSLUM80
RETAIL_LIBPURE_NAME=MSLUU80
RETAIL_PT_LIBMIXED_NAME=MLSUPTM
RETAIL_PT_LIBPURE_NAME=MLSUPTU
DEBUG_DLL_NAME=MSLUR80D
DEBUG_LIB_NAME=MSLUR80D
DEBUG_DLLCPP_NAME=MSLUP80D
DEBUG_LIBCPP_NAME=MSLUP80D
DEBUG_DLLMIXED_NAME=MSLUM80D
DEBUG_LIBMIXED_NAME=MSLUM80D
DEBUG_LIBPURE_NAME=MSLUU80D
DEBUG_PT_LIBMIXED_NAME=MLSUPTMD
DEBUG_PT_LIBPURE_NAME=MLSUPTUD
RC_NAME=MSLUR80
RCCPP_NAME=MSLUP80
RCMIXED_NAME=MSLUM80
54行处修改VCTOOLS,注意自己的VS2005安装目录,假如安装到E:/SoftWare/Microsoft Visual Studio 8/下,则此处改为:
VCTOOLS=E:/SoftWare/Microsoft Visual Studio 8/VC
1779, 1841, 1905, 1940, 2037, 2105, 2139, 2230
行的kernel32.lib,改为:unicows.lib kernel32.lib(一共8个不要改多了);
4)打开Visual Studio 2005 command prompt(从开始菜单或者是vc8的开发环境的菜单都可以启动),进入到SRC目录,输入命令设置vctools,假如VS2005安装在E:/SoftWare/Microsoft Visual Studio 8/下,则输入:
Set vctools=E:/SoftWare/Microsoft Visual Studio 8/VC
完成后输入bldnt启动SRC目录下的bldnt.bat批处理文件编译CRT库。
译者:我编译的时候出来好多warning,不管他最后还是编译完成了。
5)编译完成之后lib文件都放在SRC/BUILD/INTEL/目录下,把文件名字改回来以便以前的程序可以链接,而且下面编译MFC库也需要。DLL文件不用改,新的lib文件知道该链接到谁那里。改名:
copy MLSUPTM.LIB PTRUSTM.LIB
copy MLSUPTMD.LIB PTRUSTMD.LIB
copy MLSUPTU.LIB PTRUSTU.LIB
copy MLSUPTUD.LIB PTRUSTUD.LIB
copy MSLUR80.LIB MSVCRT.LIB
copy MSLUR80D.LIB MSVCRTD.LIB
copy MSLUP80.LIB MSVCPRT.LIB
copy MSLUP80D.LIB MSVCPRTD.LIB
copy MSLUM80.LIB MSVCMRT.LIB
copy MSLUM80D.LIB MSVCMRTD.LIB
copy MSLUU80.LIB MSVCURT.LIB
copy MSLUU80D.LIB MSVCURTD.LIB
6)把改名后的lib文件复制到VC/LIB目录下覆盖原来的文件。
7)把步骤(4)、(5)、(6)再执行一次来重建MSLUP80(D).DLL和静态库,以便他们能链接到我们自己的MSVCRT(D).LIB(指向我们的MSLUR80(D).DLL)。
关掉VS2005 command prompt,因为编译CRT库的时候定义了许多环境变量,这些会使后面MFC库的编译出现错误。
6
个新的DLL文件都在/VC/crt/src/build/intel下,把这6个文件复制到系统目录下。
二:编译MSLUMFC8.0 Unicode版本
MFC
库需要编译的是这4DLL
MFC80U.DLL (Unicode Release)
MFC80UD.DLL (Unicode Debug)
MFCM80U.DLL (Mixed mode/Managed Unicode Release)
MFCM80UD.DLL (Mixed mode/Managed Unicode Debug)

为方便操作,我们把将要输出的MSLUCRT库文件改为别的名字以免和原来的混淆,分别改成:
MFC80LU.DLL
MFC80LUD.DLL
MFCM80LU.DLL
MFCM80LUD.DLL
(如果你改成别的名字的话,后面的操作请做相应的改正)。
1)打开VC/ATLMFC/SRC/MFC/MFCDLL.MAK,在274307行的link @<<,后面插入一行变成:
 link @<<
/nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib
180
行的
LIBS=$(CRTDLL) kernel32.lib gdi32.lib msimg32.lib user32.lib uuid.lib daouuid.lib htmlhelp.lib shlwapi.lib $(PROFLIB)
改为:
LIBS=$(CRTDLL) unicows.lib kernel32.lib advapi32.lib comdlg32.lib shell32.lib oledlg.lib winspool.lib oleacc.lib gdi32.lib msimg32.lib user32.lib uuid.lib daouuid.lib htmlhelp.lib shlwapi.lib $(PROFLIB)
(此处不同于原文。原文为:
LIBS=$(CRTDLL) unicows.lib kernel32.lib gdi32.lib msimg32.lib user32.lib uuid.lib daouuid.lib htmlhelp.lib shlwapi.lib $(PROFLIB)
译者依照原文修改,编译的时候出现了错误,增加数个lib文件后编译通过)
2)打开VC/ATLMFC/SRC/MFCM/MFCMDLL.MAK,在253272行的link @<<,后面插入一行变成:
 link @<<
/nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib
215
行的
LIBS=$(CRTDLL) $(CRTMDLL) mscoree.lib kernel32.lib gdi32.lib msimg32.lib user32.lib /
改为:
LIBS=$(CRTDLL) $(CRTMDLL) mscoree.lib unicows.lib kernel32.lib advapi32.lib comdlg32.lib shell32.lib oledlg.lib winspool.lib mpr.lib oleacc.lib gdi32.lib msimg32.lib user32.lib /
(此处原文为:
LIBS=$(CRTDLL) $(CRTMDLL) mscoree.lib unicows.lib kernel32.lib gdi32.lib msimg32.lib user32.lib /
其余说明同上)
3)打开/VC/atlmfc/src/mfcm/INTEL/mfcm80u.def 文件,把第10行的LIBRARY mfcm80u 改为:
LIBRARY mfcm80Lu
打开/VC/atlmfc/src/mfcm/INTEL/mfcm80ud.def文件,把第10行的LIBRARY mfcm80ud改为:
LIBRARY mfcm80Lud
4)打开/VC/atlmfc/src/mfcm/wfrmcmd.cpp文件,251行的#error Following information required to build private version//注释掉或者直接把该行删掉;253行的[assembly: AssemblyTitle("")];改为:
[assembly: AssemblyTitle("mfcm80L")];
5)打开/VC/atlmfc/src/mfcm/interfaces/AssemblyInfo.cpp文件,78行的#error Following information required to build private version//注释掉或者直接把该行删掉;85行的[assembly: AssemblyTitle("")];改为:
[assembly: AssemblyTitle("mfcm80Lifaces")];
6)在/VC/atlmfc/src/下建立一个批处理文件:buildmfc.bat,内容为:
nmake -f atlmfc.mak MFC libname=MFC80L
7)打开Visual Studio 2005 command prompt,进入目录/VC/atlmfc/src/,输入buildmfc执行buildmfc.bat编译MFC库。
编译完成之后,在/VC/atlmfc/src/mfc/intel下有MFC80LU.DLLMFC80LUD.DLL,在/VC/atlmfc/src/mfcm/INTEL下有MFCM80LU.DLLMFCM80LUD.DLL,把这4DLL文件复制到系统目录下;在/VC/atlmfc/lib/INTEL下有MFC80LU.LIBMFC80LUD.LIBMFCM80LU.libMFCM80LUD.lib,把文件名改为:
MFC80U.LIB
MFC80UD.LIBMFCM80U.libMFCM80UD.lib
把这四个lib文件复制到/VC/atlmfc/lib下覆盖原来的文件就完成了。
 
原创粉丝点击