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. 【期望】【P5081】Tweetuzki 爱取球

    Description Tweetuzki 有一个袋子,袋子中有 \(N\) 个无差别的球.Tweetuzki 每次随机取出一个球后放回.求取遍所有球的期望次数. 取遍是指,袋子中所有球都被取出来过至 ...

  2. Linux之Json20160705

    JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.JSON采用完全独立于语言的文本格式,这些特性使JSON成为理想的数据交换语言.易于人阅读和编写,同时也易 ...

  3. 由保存当前用户引发的springboot的测试方式postman/restlet还是swagger2

    今天在测试接口的到时候发现用springboot集成swagger2集成的项目,在测试session保存的当前用户的时候,发现执行不了,没有像postman或者restlet一样,保存这个接口的url ...

  4. k8s本地搭建相信步骤

    搭建前的准备: 主机名配置 cat >/etc/hosts<<EOF127.0.0.1 localhost localhost.localdomain localhost4 loca ...

  5. qq快速登陆

    http://www.cnblogs.com/1996V/p/7481823.html qq快速登陆

  6. input file 图片上传展示重新上传

    html <div> <label class="imgMark">说明:</label> <div class="erWeiM ...

  7. jni 找不到本地方法的实现

    使用JNI开发,需要在java端声明本地方法,并在jni层实现本地方法. 有时运行项目时会先抛出异常:No implementation found for native xxx 然后直接挂掉:jav ...

  8. [LeetCode] 25. Reverse Nodes in k-Group ☆☆☆

    Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k  ...

  9. 最小割dp Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) E

    http://codeforces.com/contest/724/problem/E 题目大意:有n个城市,每个城市有pi件商品,最多能出售si件商品,对于任意一队城市i,j,其中i<j,可以 ...

  10. dfs序+主席树 BZOJ 2588 当然树链剖分+主席树也可以?

    2588: Spoj 10628. Count on a tree Time Limit: 12 Sec  Memory Limit: 128 MBSubmit: 5822  Solved: 1389 ...