c++ - 什么是 boost system error_code number 2

标签 c++ boost error-handling system

我想弄清楚 boost 系统错误代码 2 是什么。在一个程序中,他们打印出 boost 错误代码。但是,我不确定如何查找此错误代码。

如有任何帮助,我们将不胜感激。

最佳答案

不在我的脑海中:ENOENT/FileNotFound

请参阅 http://www.boost.org/doc/libs/1_58_0/libs/system/doc/reference.html#Header-error_code 中的错误代码

Live On Coliru

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

int main()
{
    boost::system::error_code ec;

    ec.assign(2, boost::system::system_category());
    std::cout << ec.message() << "\n";

    ec.assign(boost::system::errc::no_such_file_or_directory, boost::system::system_category());
    std::cout << ec.message() << "\n";
}

打印

No such file or directory
No such file or directory

关于c++ - 什么是 boost system error_code number 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29782429/

相关文章:

c++ - boost 测试 - 'undefined reference' 错误

OSX 10.6.6 上的 c++ boost 1_46_1。不链接

c++ - 亚信 : Prevent asynchronous client from being deleted?

c++ - 使用 boost::shared_ptr 时有哪些潜在危险?

c++ - 用于常见操作的标准一元函数

c - 在 C 的单个函数中处理多个 malloc 错误的推荐方法

python - Python不抛出错误或异常,websocket on_message

c++ - 月球相对于太阳的轨道

c++ - 使用 boost::lexical_cast 将 UUID 转换为字符串时出现 Boost 编译错误

javascript - 如何处理引发警报框并显示AJAX错误消息的错误?