禁用 Microsoft Visual C++ 运行时错误 [英] Disable Microsoft Visual C++ Runtime Error

查看:43
本文介绍了禁用 Microsoft Visual C++ 运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的应用程序崩溃,Microsoft Visual C++ 运行时库运行时错误!"发生.

If my application crashes, a Microsoft Visual C++ Runtime Library "Runtime Error!" occurs.

邮件正文为:
此应用程序已请求运行时以异常方式终止.
请联系应用程序的支持团队了解更多信息.

The text of the message is:
This applicaton has requested the Runtime to terminate in an unusual way.
Please contact the application's support team for more information.

我知道,我需要解决所有这些问题,但我想这个错误过去没有出现过.Visual Studio 2005 中是否有启用/禁用此类错误(处理)的选项?相反,我希望应用程序崩溃/退出并提供 Microsoft Windows 错误报告.

I know, that I need to solve all these issues, but I imagine that this error did not appear in the past. Is there an option in Visual Studio 2005 to enable/disable such error (handling)?. Instead I expect the application to just crash/exit and offer an Microsoft Windows Error Report.

推荐答案

如果未处理异常并调用 unexpected() 或在堆栈展开期间异常转义析构函数,则会出现此错误消息并且 terminate() 被调用.两者都会导致 abort() 被调用,并且它的 abort() 实现显示了消息框.这种行为是在 VS2k3、VS2k5 和 VS2k8 中设计的.这真的很烦人,尤其是在无需人工干预的情况下运行的应用程序(例如每日构建).

This error message appears if an exception is not handled and unexpected() is called or if an exception escapes a destructor during stack unwinding and terminate() is called. Both lead to abort() being called and its abort() implementation that shows the message box. This behaviour is by design in VS2k3, VS2k5 and VS2k8. It is really annoying especially in applications meant to run without human intervention (like daily builds for example).

您可以解决此问题 - 使用 catch(...) 在顶层捕获所有异常并使用 设置您自己的 terminate() 处理程序set_terminate().

You can workaround this behaviour - use catch(...) to catch all exceptions at the top level and set your own terminate() handler using set_terminate().

这篇关于禁用 Microsoft Visual C++ 运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆