R6034错误解决办法

转载自:http://hi.baidu.com/%B3%E6%B5%C4%B4%AB%C8%CB/blog/item/1ee503e785263324b838206f.html

提示没有找到MSVCR80D.dll

R6034

An application has made an attempt to load the C runtime library without using a manifest.
This is an unsupported way to load Visual C++ DLLs. You need to modify your application to build with a manifest.
For more information, see the "Visual C++ Libraries as Shared Side-by-Side Assemblies"topic in the product documentation.

这是由于manifest文件没有被正确嵌入EXE中所导致的。工程建立后默认是设定要嵌入manifest文件的,如果该文件没有被正确嵌入,那么就会报这个错误。当然如果设置生成清单(在工程属性、配置属性、连接器下的清单文件选项里),不嵌入清单(就在下面的清单工具的输入和输出选项里),那么当把manifest删掉后再运行程序,也会报这个错误。网上还看到说FAT32文件系统嵌入清单的时候需要开启下面的选项,不然也会异常。不过我用着FAT32没这个问题。倒是最近内存低的时候系统会有点异常,所以碰到了这个问题。

还看到一个德国的牛人解释:

http://blog.kalmbachnet.de/

Using the VC 2005 shared CRT/MFC (DLL) without a manifest is not supported!
If you build your app with VC2005 and you accidently have disabled the embedding of the manifest file (or deleted the separate appname.exe.manifest file), you will get an error on XP and later!

This has to do with the checking for a valid manifest of the EXE inside the CRT/MFC DLLs “DllEntry” (via a call to _check_manifest). If the OS supports manifests (or better Side-By-Side assemblies/DLLs) the CRTs´ DLL forces the check of the EXEs´ manifest. If there is no (valid) manifest, then the DLL refuses to load (returns 0) and therefor the EXE cannot be started. It might display the following error message (or similar):
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application’s support team for more information.

But in the following cases the manifest checking inside the CRT-DLL is not done:

Pre-fusion OS (FindActCtxSectionStringW not found in kernel32.dll)
Loaded by instrumented-mscoree.dll (mscoree.dll and pgort80.dll is already loaded)
The path returned with GetModuleFileNameW of the DLL is longer than 8000 characters
The path to the DLL, returned by GetLongPathName is longer than 8000 characters

解决方案

一、

1. 微软对于这个问题应该也有处理,不过感觉不是很人性化。在“属性->配置属性->清单工具->常规“下有一个”使用FAT32解决办法,把它选成是,就可以了。(注意:一定要先配置这个选项,然后再编译工程,要不然还是不好用:) 当然了
2. 找到你的工程的文件夹,),找到其下的myproject\myproject\Debug\ myproject.rec,把它删掉(删掉整个Debug目录也可以),重新编译,搞定!

二、

看到有人写了个程序向导:
1) 首先找到你的vs.net安装目录(如我的是E:\Program Files\Microsoft Visual Studio 8),定位到Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application文件夹,备份这个Application文件夹,不然一会你自己改 咂了我可不管啊:)。
2) 打开html\2052,看到两个文件了吧,就那个AppSettings.htm了,这个管着你的那个配置向导的界面,用UE(不要告诉我你不知道ue啥东西,baidu it)打开,在266行“ </SPAN>”后回车,然后插入一下内容:
<!-- this (hua)section is added by HUA. -->
<br><br><br><br><br>

<span class="itemTextTop" id="FILE_SYSTEM_SPAN" title="">选择你所使用的文件系统:

<P CLASS="Spacer"> </P>

<INPUT TYPE="radio" CLASS="Radio" checked onPropertyChange="" NAME="filesystem" ID="FAT32" ACCESSKEY="F" TITLE="FAT32">
<DIV CLASS="itemTextRadioB" ID="FAT32_DIV" TITLE="FAT32">
<LABEL FOR="FAT32" ID="FAT32_LABEL">FAT32(<U>F</U>)</LABEL>
</DIV>

<BR>

<INPUT TYPE="radio" CLASS="Radio" onPropertyChange="" NAME="filesystem" ID="NTFS" ACCESSKEY="N" TITLE="NTFS">
<DIV CLASS="itemTextRadioB" ID="NTFS_DIV" TITLE="NTFS">
<LABEL FOR="NTFS" ID="NTFS_LABEL">NTFS(<U>N</U>)</LABEL>
</DIV>
</span>
<!-- end of (hua)section -->
好,保存关闭,这个改完了,准备下一个。

3) 打开scripts\2052,这里就一个文件,ue打开它,找到138行“ var bATL = wizard.FindSymbol("SUPPORT_ATL");”其后回车,插入如下内容:
// this (hua)section is added by HUA.
var MFTool = config.Tools("VCManifestTool");
MFTool.UseFAT32Workaround = true;
// end of (hua)section
好,继续找到210行(源文件的210,你加了上边的语句就不是210了:)“ config = proj.Object.Configurations.Item("Release");”注意这次要在这行“前边”加如下内容:
// this (hua)section is added by HUA.
if(bFAT32)
{
var MFTool = config.Tools("VCManifestTool");
MFTool.UseFAT32Workaround = true;
}
// end of (hua)section

因为没有msvcr80.dll
可以改一下编译选项 多线程dll(/MD)改成多线程(MT)这样就静态链接,
也可以从你的vc8安装盘上找到再分发包vcredist_xxx.exe和你的程序捆绑安装。”

感觉以下两种解决办法是比较方便的:
方法一:
在C:\Program Files\Microsoft Visual Studio 8\VC\redi
st\Debug_NonRedist\x86\Microsoft.VC80.DebugCRT 下找到了下列文件:

msvcm80d.dll
msvcp80d.dll
msvcr80d.dll
Microsoft.VC80.DebugCRT.manifest

把这几个文件拷贝到目标机器上,与运行程序同一文件夹或放到system32下,就可以运行那个程序了。

方法二:
修改编译选项,将/MD或/MDd 改为 /MT或/MTd,这样就实现了对VC运行时库的静态链接,在运行时就不再需要VC的dll了。

在vc6下调用vs2005的动态链接库,开始弹出“没有找到MSVCR80D.dll“的对话框,
安上述的第二种方法改行不通,安第一种方法会弹出如下文字的警示窗口
An application has made an attempt to load the C runtime library without using a manifest. This is an unsupported way to load Visual C++ DLLs. You need to modify your application to build with a manifest.
for more information, see the "Visual C++ Libraries as Shared Side-by-Side Assemblies"topic in the product documentation.

Microsoft的解决方案:http://msdn.microsoft.com/zh-cn/library/ms235560(VS.80).aspx


你可能感兴趣的:(多线程,Microsoft,application,Class,dll,library)