It looks like a known bug in libstdc++.
The problem is that with the change to the C++11 ABI, many classes were duplicated in libstdc++6.so
, one version with the old ABI, other with the new one.
Exception classes were not duplicated so this problem didn't exist at the time. But then, in some newer revision of the language, it was decided that std::ios_base::failure
should derive from std::system_error
instead of std::exception
... but system_error
is a C++11 only class so it must use the new ABI flag or it will complain. Now you have two different std::ios_base::failure
classes and a mess in your hands!
The easy solution is to compile your program with -D_GLIBCXX_USE_CXX11_ABI=0
and resign to the old ABI until the bug is solved. Or alternatively, write catch (std::exception &e)
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…