1. 安装gcc,g++,make等开发环境

yum groupinstall "Development Tools"

2. 安装boost

 yum install boost boost-devel boost-doc

注意:默认的安装路径在/usr/lib64目录下

#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();
return 0;
}

  

4. makefile

g++ -I./inlcude -L./usr/lib64  test.cpp -lboost_thread-mt  -o example
注意:默认的安装路径在/usr/lib64目录下

5.结果
./example
This is task2!
This is task1!
 

最新文章

  1. Foundation框架
  2. Unlink of file &#39;.git/objects/pack/pack-***.pack&#39; failed. Should I try again? (y/n) (转)
  3. Android屏蔽HOME键
  4. C文件操作(全)
  5. 【LeetCode OJ】Max Points on a Line
  6. highcharts与highstock实例
  7. 【BZOJ】【2648】SJY摆棋子&amp;【BZOJ】【2716】【Violet 3】天使玩偶
  8. python类型转换、数值操作(转)
  9. Java基础之String,StringBuilder,StringBuffer
  10. JAVA并发实现三(线程的挂起和恢复)
  11. Palindrome Partitioning 解答
  12. s15day14 ssh秘钥远程连接
  13. Android 开发笔记___Intent的使用
  14. jdbc,mybatis,hibernate各自优缺点及区别
  15. asp.net core webapi处理Post请求中的request payload
  16. Kali学习笔记23:Web渗透简介
  17. Spring错误小结
  18. 3.9 C++多继承
  19. hierarchical_mutex函数问题(C++ Concurrent in Action)
  20. STM32F105开发板

热门文章

  1. pdf 下载整理
  2. 【题解】期末考试 六省联考 2017 洛谷 P3745 BZOJ 4868 贪心 三分
  3. OD脚本指令集
  4. Qt ------ QProcess,启动外部进程,进程间通信
  5. WPF系列之三:实现类型安全的INotifyPropertyChanged接口,可以不用“Magic string” 么?
  6. spring整合hibernate时报错:org.hibernte.engine.transaction.spi.transactioncontext
  7. 跟我一起写Makefile(二)
  8. CodeBlocks调试器设置错误问题
  9. poj 1067 取石子游戏 (威佐夫博弈)
  10. Codeforces 221 A. Little Elephant and Function