linux下编译c++程序遇到 error: ‘thread’ is not a member of ‘std’的错误
来源:互联网 发布:淘宝的需求分析报告 编辑:程序博客网 时间:2024/06/05 19:32
今天用c++写了一个socket网络编程,用 g++ client.c -o client 命令编译时出现“client.c:69:5: error: ‘thread’ is not a member of ‘std’
std::thread(RMsg).detach();” 的错误,在网上搜索原因,看到了一个外国论坛上老外给出的答案:" To get g++ into C++11(or C++0x) mode, you have to add the command-line parameter -std=c++0x on versions <=4.6 , nowadays you can also use -std=c++11 ."
按照此方法我在g++ client.c -o client 命令后面加上-std=c++11,最终编译成功。
不加参数-std=c++11编译之所以会出现错误,是因为GCC/G++默认的-std(即C++语言标准)不是C++11,在这里默认的是C++98,所以需要显式地开启,即添加-std=c++11参数。
0 0
- linux下编译c++程序遇到 error: ‘thread’ is not a member of ‘std’的错误
- Code blocks error: 'thread' is not a member of 'std'|
- 遇到 'for_each' is not a member of 'std' 的问题
- Blitz++ error: 'labs' is not a member of 'std'
- error C2039: 'wstring' : is not a member of 'std'(转)
- error C2039: 'bitset' : is not a member of 'std'
- error C2039: 'min' : is not a member of 'std'
- : error: ‘cout’ is not a member of ‘std’
- shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std' 错误修正
- cocos2dx ant编译'atoi' is not a member of 'std'
- Qt 解决“is not a member of ‘std’”错误
- C++:set_union is not a member of std;
- 'find_if’ is not a member of ‘std'
- 'numeric_limits' is not a member of 'std'|
- 'numeric_limits' is not a member of 'std'
- cocos2d-x-2.2.5 Eclipse编译报错 error: 'transform' is not a member of 'std' (IOS没有问题)
- rapidsvn 编译错误: OnOK is not a member of CheckoutDlg
- c++ 编译错误is not a static member of ...
- 求助:将搜索出来的周边信息显示在界面上
- HashMap解决hash冲突的方法
- 跨域获取数据ajax方式
- 如何为WordPress的网站建立多级菜单?
- C/C++学习启动篇
- linux下编译c++程序遇到 error: ‘thread’ is not a member of ‘std’的错误
- IOS 图片动画效果
- 【SVN】关于 The OPTIONS request returned invalid XML in the response: XML parse error 的 解决方案
- android通信机制学习(一)
- Python3:好玩游戏的物品清单 和 列表到字典的函数
- google搜索技巧
- 间隔一段时间进行后台定位
- 用mybatis 拦截器实现数据权限
- 支持我么