您的位置:首页 > 移动开发

VS2005 编译环境,解决 Runtime Error(运行时错误): R6034。

2011-08-02 21:39 471 查看
 
Posted onDecember
8, 2007 by王永杰

问题:Runtime Error R6034

在VS2005编译环境下,用makefile编译的程序爆出了一个可恶的Runtime Error。

错误如下图:


提示信息是:

Runtime Error!

R6034

An application has made an attempt to load the C runtime library incorrectly. Please contact the application’s support team for more information.

无法正常载入 C runtime library。

问题追因

程序生成之后直接执行是没有问题的,而打包后的程序却有问题,看来应该是缺少了什么文件。于是我对编译程序生成的文件一个个删除,并查看检查程序的运行情况。在$(APP).exe.manifest被文件删除之后,R6034现身了,看来罪魁祸首就是它了。

我又在MSDN上搜索R6034,得到了这个Error描述的:

C Run-Time Error R6034

Error Message

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.

这么以来更确认了出现这个问题的原因:缺少了manifest,程序因此无法正常载入C runtime library。

解决办法

解决方法有两个:

将编译得到的 $(APP).exe.manifest 一并打包,即和应用程序放在同一个文件夹下;
将manifest文件直接嵌入到可执行文件。

嵌入到可执行文件的方法是,需要在生成exe之后在执行下面的命令:

mt.exe –manifest $(APP).exe.manifest -outputresource:$(APP).exe;1

编译DLL的话,有一点点小区别的。

mt.exe –manifest $(LIB).dll.manifest -outputresource:$(LIB).dll;2

后话

VC2005搞出个这玩意有什么好处?

 

 

 

转自:http://wyj.zhuwo.info/2007/12/vs2005-%E7%BC%96%E8%AF%91%E7%8E%AF%E5%A2%83%EF%BC%8C%E8%A7%A3%E5%86%B3-runtime-error%E8%BF%90%E8%A1%8C%E6%97%B6%E9%94%99%E8%AF%AF-r6034%E3%80%82/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐