我的程序中有这样的代码:
catch (boost::exception& ex) { // error handling }
我该如何打印细节?错误信息,堆栈跟踪等?
您可以使用boost :: diagnostic_information()来获取实际的错误消息和异常的来源.即
catch (const boost::exception& ex) { // error handling std::cerr << boost::diagnostic_information(ex); }