最近一个项目从vc6迁移到VS2005,在修改了一系列的类型警告后。编译成功了,Debug的时候,结果却冒出一个R6034错误:"An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information."
查了很多资料:最后总结如下:
google 了一下,找到了某德国牛人的文章
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.编译条件是:Linker->Manifest File ->Allow Isolation:Yes。
2. 在“属性->配置属性->清单工具->常规“下有一个”使用FAT32解决办法,设置为"是"
3. 找到你的工程的文件夹,如(myproject),找到其下的myproject\myproject\Debug\,Delete it.
4.同时删除了myproject.manifest.exe
5.不知道有没有用?在stdadx.h中加了#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")
参考同学内容:
http://topic.csdn.net/u/20080131/14/06abd302-a469-4a4a-82ea-2fe3bfd2e102.html?738687976
http://www.cppblog.com/MDnullWHO/articles/43949.html
同时总结大部分导入的debug:
1.CFile readHuge() 修改位 read
2.不能导入 include "olestd.h" 在VC6.0中搜到该文件加入
3.找不到文件 mfc80.dll
msvcr80.dll
文件,找到加入
3.多数i未定义,可严格定义及解决
4,窗口映射函数 LRESULT类型报错,修改void为该类型,函数返回0.
5.如果修改代码处实在太多,建议放弃修改。呵呵