C++ 增压系统发出errc::timed类型的“U error”代码,其信息为;“未知错误”;

C++ 增压系统发出errc::timed类型的“U error”代码,其信息为;“未知错误”;,c++,boost,boost-system,C++,Boost,Boost System,为什么下面的代码输出“未知错误”?我期待一些其他消息,如“操作超时”或其他描述性错误 操作系统:Windows7 升幅:1.57 #include <iostream> #include "boost/system/system_error.hpp" void main() { boost::system::error_code ec = make_error_code(boost::system::errc::timed_out); auto message =

为什么下面的代码输出“未知错误”?我期待一些其他消息,如“操作超时”或其他描述性错误

操作系统:Windows7 升幅:1.57

#include <iostream>
#include "boost/system/system_error.hpp"

void main()
{
    boost::system::error_code ec = make_error_code(boost::system::errc::timed_out);
    auto message = ec.message();
    std::cout << message << std::endl;
}
#包括
#包括“boost/system/system\u error.hpp”
void main()
{
boost::system::error\u code ec=make\u error\u code(boost::system::errc::timed\u out);
自动消息=ec.message();

建议您检查包含路径、库路径和项目设置

我已更正程序(main必须返回int)并在clang下编译:

#include <iostream>
#include <boost/system/system_error.hpp>

int main()
{
    boost::system::error_code ec = make_error_code(boost::system::errc::timed_out);
    auto message = ec.message();
    std::cout << message << std::endl;
}
结果:

Operation timed out

我的boost安装已安装到前缀${HOME}/local

请发布最简单的完整示例。这意味着我可以编译而无需猜测。代码已更新-感谢您的建议我认为这可能是Windows的问题。@klmurphy72您是否尝试过将错误指定给错误条件而不是错误代码?我将错误代码更改为错误条件,结果是在我看来,这似乎是正确的,因为错误值和类别保持不变。至少我是这样理解的。这两种方法都以“generic_error_category::message(int ev)”结尾。
Operation timed out