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. python基础----面向对象的程序设计(五个阶段、对小白的忠告、关于OOP常用术语)、类、对象

    一.面向对象的软件开发有如下几个阶段                                              1.面向对象分析(object oriented analysis ,O ...

  2. oracle 时间

    select to_char(to_date(sysdate,'yyyy-mm-dd'),'day') from dual; select to_date('2017-12-31','day') fr ...

  3. Codeforces 25.E Test

    E. Test time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  4. 「Django」rest_framework学习系列-用户认证

    用户认证:1.项目下utils文件写auth.py文件 from rest_framework import exceptions from api import models from rest_f ...

  5. java中16进制转换10进制

    java中16进制转换10进制 public static void main(String[] args) { String str = "04e1"; String myStr ...

  6. Ubuntu+NDK编译支持HTTPS的libcurl

    参考文章:1.NDK环境配置 http://blog.csdn.net/smfwuxiao/article/details/65877092.libcurl的配置修改 http://piggyq.co ...

  7. base64解码

    网络传输经常用base64编码的数据,因此我们需要将其解码成正常字符集合. base64.h #ifdef __cplusplus extern "C" { #endif char ...

  8. TestNG指南

    转载自:http://blog.csdn.net/bigapplestar/article/details/7300137 今天突然收到通知,统一改用TestNG写测试用例,开始查这方面的资料,学习一 ...

  9. C11线程管理:条件变量

    1.简介 C11提供另外一种用于等待的同步机制,它可以阻塞一个或者多个线程,直到收到另外一个线程发出的通知或者超时,才会唤醒当前阻塞的线程.条件变量要和互斥量配合起来使用. condition_var ...

  10. React-music 全家桶项目

    React-Music 全家桶项目 一.简介 该项目是基于React全家桶开发的一个音乐播放器,技术栈采用:Webpack + React + React-redux + React-router + ...