在测试普通机器上测试 Visual C exe 无法启动
此应用程序无法启动 因为应用程序配置 是不正确的。 重新安装 应用程序可能会解决此问题。
这是我在未安装 Visual Studio 的系统上尝试调试文件时得到的结果。 我尝试将 Debug_NonRedist\x86\Microsoft.VC90.DebugCRT 复制到与我的 exe 相同的文件夹中,但没有成功。
- dll位于exe文件夹中的Microsoft.VC90.DebugCRT文件夹中。
- dll和dll在同一个exe文件夹中。
我也安装了“Microsoft Visual C++ 2008 Redistributable Package”。
This Application has failed to start
because the application configuration
is incorrect. Reinstalling the
application may fix this problem.
This is what I get when i try my debug file on a system without visual studio installed.
I tried to copy the Debug_NonRedist\x86\Microsoft.VC90.DebugCRT in the same folder as my exe, with no luck.
- dll in Microsoft.VC90.DebugCRT folder in exe folder.
- dll in same exe folder and dll.
I have installed "Microsoft Visual C++ 2008 Redistributable Package" too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
调试 CRT 不可分发。 “Microsoft Visual C++ 2008 Redistributable Package”不包括调试 CRT。 该应用程序有一个自动生成的清单,告诉操作系统从 SxS 系统加载调试 CRT。
请参阅这篇 CodeProject 文章,了解使用私有程序集的方法,以便您的应用程序使用您手动复制到其他系统的调试 CRT dll。
The debug CRT is not distributable. The "Microsoft Visual C++ 2008 Redistributable Package" does not include the debug CRT. The application has an automatically generated manifest that is telling the OS to load the debug CRT from the SxS system.
See this CodeProject article for ways to use a private assembly so that your app uses the debug CRT dlls that you manually copy over to the other system.
最简单的解决方案是使用静态链接而不是动态链接的 CRT 来编译 exe。
使用 Visual Studio 打开项目。
从菜单“项目”->“属性”中选择(或右键单击项目并选择“属性:从解决方案资源管理器”)。
从选项卡式树控件中:配置属性:C /C++:代码生成
将“运行时库”设置从“多线程调试 DLL (/MDd)”更改为“多线程调试 (/MTd)”
重建,重新复制,一切都应该很好
否则,另一个解决方案是实际构建一个捆绑 VC9 运行时位的 MSI。 构建包含以下 MSM 合并模块的安装项目:
“C:\Program Files\Common Files\Merge Modules\Microsoft_VC90_DebugCRT_x86.msm”
“C:\Program Files\Common Files\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm”
(如果您运行的是 64 位,这些文件位于“c:\program files (x86)”目录中。)
最后,如果这不不起作用,您可能还需要复制一些其他 DLL(MFC?)。 我相信当您收到“应用程序配置不正确”错误时,您可以查看系统事件日志(控制面板->管理工具->事件查看器)。 通常会有有关丢失 DLL 的详细错误消息。
The simplest solution to do is to compile your exe with the CRT statically linked instead of dynamically linked.
Open your project with Visual Studio.
Select from the menu Project->Properties (or right click on the project and select "Properties: from the Solution Explorer).
From the tabbed tree control: Configuration Properties : C/C++ : Code Generation
Change the "Runtime library" setting from "Multi-threaded Debug DLL (/MDd)" to "Multi-threaded Debug (/MTd)"
Rebuild, recopy, and all shoudl be good
Otherwise, the other solution is to actually build an MSI that bundles the VC9 runtime bits. Build a setup project that includes these MSM merge modules:
"C:\Program Files\Common Files\Merge Modules\Microsoft_VC90_DebugCRT_x86.msm"
"C:\Program Files\Common Files\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm"
(If you are running 64bit, these files are in your "c:\program files (x86)" directory.)
Finally, if this doesn't work, you probably got some other DLL (MFC?) that might need to be copied as well. I believe when you get the "application configuration is incorrect" error, you can look at the System Event logs (Control Panel->Admin tools->Event Viewer). There is usually a detailed error message about the missing DLL.
我建议制作一个发布版本并在普通计算机上尝试(以及该计算机上安装的 Microsoft Visual C++ 2008 Redistributable Package),然后看看是否有效。
您的应用程序很可能还使用您可能没有复制的 MFC 和 C++ DLL。 即MFC90D.DLL、MSVCR90D.DLL、MSVCP90D.DLL
I would suggest making a release build and trying that on the vanilla machine (along with the Microsoft Visual C++ 2008 Redistributable Package installed on that machine), and see if that works.
It is quite possible that your application also uses MFC and C++ DLLs that you might not have copied over. i.e. MFC90D.DLL, MSVCR90D.DLL, MSVCP90D.DLL