Error message when you try to run a Visual C++ application: "This application has failed to start because theapplication configuration is incorrect. Reinstalling the application may fix the problem"
Article ID: 948854 -
View products that this article applies to.
当你的用VC开发的程序启动时,弹出“此程序启动因程序配置错误启动失败,重新安装或可解决问题。
可以参考MS网站Article ID: 948854 - View products that this article applies to.
SYMPTOMS: 症状
When you run a Visual C++ executable file or DLL that contains embedded debug information, the application does not start. Additionally, you receive the following error message:
运行VC的执行文件或DLL时,这些文件包含了调试信息。程序未能启动,会弹出如下信息:
This problem occurs if the Microsoft Visual C++ Redistributable Package (VCRedist.exe) has been used to deploy Visual C++ DLLs on the computer.
此类问题的发生,是因此PC(注:当然是开发者用的了)用MS VC++的重发布包(VCRedist.exe)绑定了VC的DLL库。
运行VC的执行文件或DLL时,这些文件包含了调试信息。程序未能启动,会弹出如下信息:
This
application has failed to start because the
application configuration is
incorrect. Reinstalling the
application may fix the problem.
此程序启动因程序配置错误启动失败,重新安装或可解决问题。
此程序启动因程序配置错误启动失败,重新安装或可解决问题。
此类问题的发生,是因此PC(注:当然是开发者用的了)用MS VC++的重发布包(VCRedist.exe)绑定了VC的DLL库。
CAUSE: 原因
This issue occurs when one of the following conditions is true:
以下之一的条件符合时,会发生此类情况:
以下之一的条件符合时,会发生此类情况:
- The VCRedist.exe file that is installed is for a different version of Visual C++.
所安装的VCRedist.exe和VC++版本不一致。 - The VCRedist.exe file did not install the debug build of Visual C++ DLLs on the computer.
VCRedist.exe未安装Debug版本的VC DLL.
RESOLUTION: 解决方案
To resolve this issue, you can use the Dependency Walker tool to document all the DLLs that a Visual C++ application uses. To do this, use the following methods in the order that they are presented.要解决此问题,你可以使用“Dependency Walker”的工具来记录此程序所用的VC++ dll文件。如下述方法:
Method 1: Install the Dependency Walker tool
1. 安装Dependency Walker tool
The Dependency Walker tool is part of the Windows Support Tools. The Support Tools are not installed with the Windows operating system. Instead, you must install them separately from the \Support\Tools folder of the Windows operating system CD. To install Windows Support Tools, see the "Install Windows Support Tools" section of the following Microsoft Web site:
Dependency Walker tool是Windows的支援工具之一。这些工具并未随Windows安装,所以你需要在Windows OS CD上独立安装(参照\Support\Tools目录)。你也可以在MS官网上获取这个工具的有关章节。
http://technet2.microsoft.com/windowsserver/en/library/baa79cdd-83b0-4f10-9356-b2d14462d5b21033.mspx?mfr=true
(http://technet2.microsoft.com/windowsserver/en/library/baa79cdd-83b0-4f10-9356-b2d14462d5b21033.mspx?mfr=true)
Method 2: Determine which DLLs the application depends on
2. 检查这个程序依赖了哪些DLL文件
To determine which DLLs the application depends on, use the Dependency Walker tool to scan the Visual C++ application. To do this, follow these steps:
按以下步骤使用Dependency Walker tool来检查这个VC++程序所依赖的哪些DLL文件
- In Windows Explorer, locate the application and any DLLs that the application requires. 在文件浏览器中定位到这个程序以及所需要的DLL文件。
- Right-click the application, and then clickView Dependencies. 右击程序,选择“View Dependencies”。
Dependency Walker 会扫描这个程序,并建立一个分级的树状列表来描述此程序的依赖关系。有一个依赖项则是CRT会被用到,诸如Msvcr80d.dll,它包含了调试信息(注意d字样)。
Method 3: Copy dependent DLL files
3. 拷贝这些被依赖的DLL文件
If an older version of the debug version of the CRT is installed, or if the files are not present on the computer, you must provide copies of the debug version of the CRT that was used to build the Visual C++
application. To do this, follow these steps:
- On the development computer, locate the debug version of the CRT. This version is located in the following Visual Studio folder:
..\VC\redist\Debug_NonRedist
- Copy the necessary DLL file assemblies from this folder.
- On the computer on which you want to run the application, copy the DLL file assemblies into a folder that has the same name and path under the folder for the Visual C++ application.