小编luy*_*uan的帖子

抛出“std::system_error”实例后调用终止

当我std::call_once在 Linux 2.6.36 版中使用时,出现错误:

terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Aborted
Run Code Online (Sandbox Code Playgroud)

编译命令:

mipsel-buildroot-linux-uclibc-g++ callonce.cpp -o callonce -static -lpthread
Run Code Online (Sandbox Code Playgroud)

我的代码:

#include <iostream>
#include <mutex>
using namespace std;
int main()
{
    cout << "Hello world" << std::endl;
    static once_flag of;
    call_once(of,[]{});

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ multithreading libstdc++ c++11

5
推荐指数
1
解决办法
689
查看次数

标签 统计

c++ ×1

c++11 ×1

libstdc++ ×1

multithreading ×1