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!
 

centos使用boost过程的更多相关文章

  1. Centos 安装boost库

    1.在http://www.boost.org/下载boost安装包boost_1_65_1.tar.gz 2.在Centos上解压tar -zxvf  boost_1_65_1.tar.gz后,cd ...

  2. centos安装cowboy过程

    在centos机器上安装erlang: yum install erlang -y 接着把之前在ubuntu上的cowboy工程拷贝到centos机器上,进入到工程目录,输入: make run 提示 ...

  3. U盘在电脑上安装CentOS 7 系统过程详解

    U盘制作CentOS系统启动盘 在电脑上下载并安装UltraISO软件,如百度云:http://pan.baidu.com/s/1hrGtvEG 打开UltraISO软件,找到CentOS.iso的映 ...

  4. CentOS 7安装过程

    下载: https://wiki.centos.org/Download 安装过程: 参考: http://tieba.baidu.com/p/3152957061(图片出处)

  5. centos安装tmux过程

    原文:https://gist.github.com/rothgar/cecfbd74597cc35a6018 # Install tmux on Centos release 6.5 # insta ...

  6. centos 虚拟机安装过程

    centos装过好几次了,也装过好几次fedora,感觉centos更灵活些,这次我装了最简洁的centos,然后通过yum命令安装了各种需要的命令和软件,编译了phpredis.redis.和php ...

  7. python easy_install centos 下安装过程和原理解析

    一.easy_install 安装过程 其安装过程有很多种,我也找了很多的例子,但是结果都不太好,以下方法的结果是不错的. easy_install与yum类似,使用easy_install,可以轻松 ...

  8. CentOS 7 安装过程中设置网络

    如果在安装过程中需要使用网络,需要启动网卡,默认是DHCP 点击configure进入设置 General 常规设置 Automatically connect to this network whe ...

  9. 解决CentOS下boost安装后不能使用的问题

    先说一说整个经历. 因为之前没有注意到gcc4.8.5比较旧,就已经安装好boost了,当时已经可以使用了,后来发现gcc太老了,一些软件安装需要比较新的gcc支持,所以决定升级gcc,结果boost ...

随机推荐

  1. 嘘,如何激活更新的win10

    win10更新了,所以很坑的是以前的密钥又不管用了,系统和office都要重新激活,然而微软的更新就是很有恶意的,总之成功率堪忧. 还好看到了万能的网友的办法. slmgr.vbs /upk slmg ...

  2. 清除localstorage

    h5本地存储localStorage,sessionStorage. localStorage是没有失效时间的,sessionStorage的声明周期是浏览器的生命周期. 当浏览器关闭时,sessio ...

  3. Cochran’s Q Test

    sklearn实战-乳腺癌细胞数据挖掘(博客主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&a ...

  4. BFC 块级元素格式化上下文

    Block Formatting Contexts: 块级元素格式化上下文块级元素如何对它的内容(子元素:也是一个块元素)进行布局,以及与其它元素(与内容同级别)的关系和相互作用 普通文档流的布局规则 ...

  5. TypeError: only integer scalar arrays can be converted to a scalar index

    TypeError: only integer scalar arrays can be converted to a scalar index 觉得有用的话,欢迎一起讨论相互学习~Follow Me ...

  6. Error : getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443

    环境 阿里云 centos7 node v8.11.3 npm 5.6.0 错误 npm update 解决 ping registry.npmjs.org 发现https://registry.np ...

  7. uva 11971 Polygon

    https://vjudge.net/problem/UVA-11971 有一根长度为n的木条,随机选k个位置把它们切成k+1段小木条.求这些小木条能组成一个多边形的概率. 将木条看做一个圆,线上切k ...

  8. Python学习笔记(三十三)常用内置模块(2)collections_namedtuple_deque_defaultdict_OrderedDict_Counter

    摘抄自:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001431953239 ...

  9. h5 canvas动画,不知道谁写的

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  10. html中插入其他html,并实现动态效果!

    <html> <body> 倒计时开始...... <span id="s1">888</span> <!--在html中先做 ...