IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> C++知识库 -> c++ 学习笔记(0) boost 环境搭建 -> 正文阅读

[C++知识库]c++ 学习笔记(0) boost 环境搭建

0 .获得boost 源码 并且编译 安装

[jeason@centos7 ~]$ git clone https://gitee.com/add358/boost.git
Cloning into 'boost'...
remote: Enumerating objects: 97421, done.
remote: Total 97421 (delta 0), reused 0 (delta 0), pack-reused 97421
Receiving objects: 100% (97421/97421), 173.74 MiB | 8.07 MiB/s, done.
Resolving deltas: 100% (51972/51972), done.
[jeason@centos7 ~]$ cd boost/
[jeason@centos7 boost]$ git tag
1.71.0
[jeason@centos7 boost]$ git checkout 1.71.0
Note: checking out '1.71.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at ab8d0ff2c... version 1.71.0
[jeason@centos7 boost]$ ls
boost            boostcpp.jam  boost.png      bootstrap.sh  index.htm   INSTALL  libs             more       rst.css  tools
boost-build.jam  boost.css     bootstrap.bat  doc           index.html  Jamroot  LICENSE_1_0.txt  README.md  status   version
[jeason@centos7 boost]$ ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... /usr
Generating Boost.Build configuration in project-config.jam for gcc...

Bootstrapping is done. To build, run:

    ./b2

To generate header files, run:

    ./b2 headers

To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help

   - Getting started guide:
     http://www.boost.org/more/getting_started/unix-variants.html

   - Boost.Build documentation:
     http://www.boost.org/build/

[jeason@centos7 boost]$ ./b2
Performing configuration checks

    - default address-model    : 64-bit
    - default architecture     : x86

Building the Boost C++ Libraries.
# 注意 这里开始进行代码的编译 依据不同的主机的性能去进行评定 我在服务器上编译大约不到2分钟 ?
*********************************************************************************************************
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.8.5/release/link-static/threading-multi/visibility-hidden/instantiate_re2c_lexer.o
gcc.archive bin.v2/libs/wave/build/gcc-4.8.5/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/libboost_wave.a
common.copy /home/jeason/boost/stage/lib/libboost_wave.a
...updated 1380 targets...


The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/jeason/boost

The following directory should be added to linker library paths:

    /home/jeason/boost/stage/lib

[jeason@centos7 boost]$
[jeason@centos7 boost]$ sudo ./b2 install
Performing configuration checks

    - default address-model    : 64-bit (cached)
    - default architecture     : x86 (cached)
    - symlinks supported       : yes (cached)
    - C++11 mutex              : no  (cached)
    - lockfree boost::atomic_flag : yes (cached)
    - Boost.Config Feature Check: cxx11_auto_declarations : no  (cached)
    - Boost.Config Feature Check: cxx11_constexpr : no  (cached)
    - Boost.Config Feature Check: cxx11_defaulted_functions : no  (cached)
    - Boost.Config Feature Check: cxx11_final : no  (cached)
    - Boost.Config Feature Check: cxx11_hdr_mutex : no  (cached)
    - Boost.Config Feature Check: cxx11_hdr_tuple : no  (cached)
    - Boost.Config Feature Check: cxx11_lambdas : no  (cached)
    - Boost.Config Feature Check: cxx11_noexcept : no  (cached)
    - Boost.Config Feature Check: cxx11_nullptr : no  (cached)
    - Boost.Config Feature Check: cxx11_rvalue_references : no  (cached)
    - Boost.Config Feature Check: cxx11_template_aliases : no  (cached)
    - Boost.Config Feature Check: cxx11_thread_local : no  (cached)
    - Boost.Config Feature Check: cxx11_variadic_templates : no  (cached)
    - has_icu builds           : yes (cached)

# *************************** 忽略 中间的打印
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/csetjmp
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/csignal
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cmath
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/clocale
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/climits
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cfloat
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cerrno
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cctype
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cassert
...updated 16211 targets...

1. 简单的测试

#include <boost/timer/timer.hpp>
#include <iostream>

using namespace boost;
int main()
{
    timer t;
    std::cout << t.elapsed_max() <<std::endl;
    return 0;
}
[jeason@centos7 ~]$ g++ test.cpp
In file included from test.cpp:1:0:
/usr/local/include/boost/timer.hpp:21:98: note: #pragma message: This header is deprecated. Use the facilities in <boost/timer/timer.hpp> instead.
 BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp>" )                               
[jeason@centos7 ~]$ ./a.out
9.22337e+12
[jeason@centos7 ~]$ rm a.out

  C++知识库 最新文章
【C++】友元、嵌套类、异常、RTTI、类型转换
通讯录的思路与实现(C语言)
C++PrimerPlus 第七章 函数-C++的编程模块(
Problem C: 算法9-9~9-12:平衡二叉树的基本
MSVC C++ UTF-8编程
C++进阶 多态原理
简单string类c++实现
我的年度总结
【C语言】以深厚地基筑伟岸高楼-基础篇(六
c语言常见错误合集
上一篇文章      下一篇文章      查看所有文章
加:2021-12-09 11:28:26  更:2021-12-09 11:28:54 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 12:11:20-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码