Search code examples
exceptionboost

Boost - cannot get exception information


I had found the solution to this but I removed the code and today, I just cannot build this

try
{
    ...
}
catch (boost::exception const& ex)
{
    std::cerr << *boost::get_error_info<errmsg_info>(ex) << std::endl;
}

gives me

error: no template named 'get_error_info' in namespace 'boost'; did you mean 'error_info'?
          

I tried

std::cerr << boost::diagnostic_information(ex) << std::endl;
error: no member named 'diagnostic_information' in namespace 'boost'


std::cerr << boost::get_error_info(ex) << std::endl;
error: no member named 'get_error_info' in namespace 'boost'

same sort of errors, diagnostic_information unknown, get_error_info unknown

Please help me out on this

thanks


Solution

  • It looks like you forgot to include

    #include <boost/exception/get_error_info.hpp>