c++ 学习笔记(0) boost 环境搭建

c++ 学习笔记(0) boost 环境搭建,第1张

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 

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 
#include 

using namespace boost;
int main()
{
    timer t;
    std::cout << t.elapsed_max() < 
[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  instead.
 BOOST_HEADER_DEPRECATED( "the facilities in " )                               
[jeason@centos7 ~]$ ./a.out
9.22337e+12
[jeason@centos7 ~]$ rm a.out

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5651275.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存