centos(x86 64位系统)使用boost
2024-08-26 21:23:30
1. 安装gcc,g++,make等开发环境
yum groupinstall "Development Tools"
2. 安装boost
yum install boost boost-devel boost-doc
备注:默认的安装路径在/usr/lib64目录下
3. 例子
#include <boost/thread.hpp> #include <iostream> void task1() { // do stuff std::cout << "This is task1!" << std::endl; } void task2() { // do stuff std::cout << "This is task2!" << std::endl; } int main (int argc, char ** argv) { using namespace boost; thread thread_1 = thread(task1); thread thread_2 = thread(task2); // do other stuff thread_2.join(); thread_1.join(); ; }
4. 编译
g++ -I./inlcude -L./usr/lib64 asio_thread.cpp -lboost_thread-mt -o example
5.运行:
This is task2! This is task1!
最新文章
- 让VS2010支持Windows2000
- .Net的内置对象之一 Request
- Bash 中 SHLVL 变量为 1000 的时候
- javascript运行模式:并发模型 与Event Loop
- bzoj4400: tjoi2012 桥
- 转载~kxcfzyk:Linux C语言多线程库Pthread中条件变量的的正确用法逐步详解
- 【linux】xrander/cvt自定义分辨率
- CallableAndFuture
- 虚拟攻防系统 HoneyPot
- Linux/Ubuntu下 静态编译Qt程序
- struts2 result type的类型
- Http2改造实践:statusText丢失问题
- Linux系列教程(十二)——Linux软件包管理之yum在线管理
- Mybatis实现 --文件夹
- UWP 图片模糊
- java集合类,HashMap,ArrayList
- Vue proxyTable 解决开发环境的跨域问题
- ApiCloud开发经验总结
- Python 3 实现定义跨模块的全局变量和使用
- android studio 怎么做屏幕适配?
热门文章
- Objective C 快速入门学习一
- phpcms常用方法简介
- SQL 执行计划(二)
- 小波变换C++实现(一)----单层小波变换
- [转载]Python 3.5 协程究竟是个啥
- IDEA Error:java: 未结束的字符串文字
- ios NSURLSession completeHandler默认调用quque
- Effective C++ -----条款40:明智而审慎地使用多重继承
- Effective C++ -----条款24:若所有参数皆需类型转换,请为此采用non-member函数
- js判断手机端操作系统(Andorid/IOS),并自动为链接添加相应下载地址