大佬教程收集整理的这篇文章主要介绍了g ++ 4.8.1 C ++线程,std :: system_error-不允许操作吗?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是在这里回答
g++ -Wl,--no-as-needed -std=c++11 -pthread main.cpp -o main.out
这不是一个重复的问题,因为提出的解决方案不适用于我的编译器。我正在尝试从该问题编译并运行以下示例。
#include <thread>
#include <iostream>
int main(int,char **){
std::thread tt([](){ std::cout<<"Thread!"<<std::endl; });
tt.join();
}
我已尝试使用该原始问题以及对此重复项目的公认答案中提供的解决方案。但是,尽管我尝试了所有列出的组合,特别是尝试了
g++ main.cpp -o main.out -pthread -std=c++11
当我运行生成的可执行文件时,我仍然得到
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
Aborted (core dumped)
这是的输出g++ --version
。
g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
Copyright (C) 2013 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITnesS FOR A PARTICULAR PURPOSE.
我需要使用其他顺序或命令集g++ 4.8.1
吗?
以上是大佬教程为你收集整理的g ++ 4.8.1 C ++线程,std :: system_error-不允许操作吗?全部内容,希望文章能够帮你解决g ++ 4.8.1 C ++线程,std :: system_error-不允许操作吗?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。