try-catch在我的产品代码中不起作用

时间:2018-05-10 05:58:46

标签: c++ try-catch

我在产品代码中面临try-catch块的问题。 以前我的代码用于构建gcc 4.3.2。现在我正在尝试针对4.9.1构建它。 它已成功编译,但是当我运行它时,try和catch块所在的所有区域都不起作用。 即当有一个抛出时,它会抛出一个SIGABRT(信号6),并且进程终止。 我可能会在这里失踪什么。有些图书馆还是什么?

以下是我在svupdate中尝试过的一些示例代码。

try
{
    printf("Before the std::exception");
    throw std::exception(); ---> The process gets aborted here with  ["Abort trap: 6 (core dumped)"]
    printf("After the std::exception");
}
catch (...)
{
    printf("ignoring this time"); ---> This is not being logged 
}

0 个答案:

没有答案
相关问题