【发布时间】:2010-10-07 21:00:33
【问题描述】:
我想禁用在 MSVC 下编译的 C++ 应用程序中的异常。我已将启用 C++ 异常选项切换为否,但我收到警告,告诉我使用选项 /Ehsc,我不想这样做。
我的代码中没有 try/catch 块,但我使用 STL。我发现使用宏定义 _HAS_EXCEPTIONS=0 应该禁用 STL 中的异常,但我仍然收到如下警告:
warning C4275: non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_typeid'
see declaration of 'stdext::exception'
see declaration of 'std::bad_typeid'
有什么办法可以关闭异常是STL?
注意:在我的代码中,我也想关闭 RTTI 选项。无论 RTTI 是打开还是关闭,我都会收到相同的警告。
【问题讨论】:
标签: c++ visual-c++ stl exception-handling