Questions in category: boost (boost)
软件 >> C++ >> boost

1. 批量重命名文件

Posted by haifeng on 2022-02-17 13:27:05 last update 2022-02-17 13:27:49 | Answers (0) | 收藏


现有74个文件, 文件名如下. 要求将 oddpages_part$k$(1).pdf 改名为“扫描0xxx.pdf”, 其中 xxx =$2k-1$.

例如:   oddpages_part18(1).pdf   -->  扫描0035.pdf

    oddpages_part1(1).pdf
    oddpages_part10(1).pdf
    oddpages_part11(1).pdf
    oddpages_part12(1).pdf
    oddpages_part13(1).pdf
    oddpages_part14(1).pdf
    oddpages_part15(1).pdf
    oddpages_part16(1).pdf
    oddpages_part17(1).pdf
    oddpages_part18(1).pdf
    oddpages_part19(1).pdf
    oddpages_part2(1).pdf
    oddpages_part20(1).pdf
    oddpages_part21(1).pdf
    oddpages_part22(1).pdf
    oddpages_part23(1).pdf
    oddpages_part24(1).pdf
    oddpages_part25(1).pdf
    oddpages_part26(1).pdf
    oddpages_part27(1).pdf
    oddpages_part28(1).pdf
    oddpages_part29(1).pdf
    oddpages_part3(1).pdf
    oddpages_part30(1).pdf
    oddpages_part31(1).pdf
    oddpages_part32(1).pdf
    oddpages_part33(1).pdf
    oddpages_part34(1).pdf
    oddpages_part35(1).pdf
    oddpages_part36(1).pdf
    oddpages_part37(1).pdf
    oddpages_part38(1).pdf
    oddpages_part39(1).pdf
    oddpages_part4(1).pdf
    oddpages_part40(1).pdf
    oddpages_part41(1).pdf
    oddpages_part42(1).pdf
    oddpages_part43(1).pdf
    oddpages_part44(1).pdf
    oddpages_part45(1).pdf
    oddpages_part46(1).pdf
    oddpages_part47(1).pdf
    oddpages_part48(1).pdf
    oddpages_part49(1).pdf
    oddpages_part5(1).pdf
    oddpages_part50(1).pdf
    oddpages_part51(1).pdf
    oddpages_part52(1).pdf
    oddpages_part53(1).pdf
    oddpages_part54(1).pdf
    oddpages_part55(1).pdf
    oddpages_part56(1).pdf
    oddpages_part57(1).pdf
    oddpages_part58(1).pdf
    oddpages_part59(1).pdf
    oddpages_part6(1).pdf
    oddpages_part60(1).pdf
    oddpages_part61(1).pdf
    oddpages_part62(1).pdf
    oddpages_part63(1).pdf
    oddpages_part64(1).pdf
    oddpages_part65(1).pdf
    oddpages_part66(1).pdf
    oddpages_part67(1).pdf
    oddpages_part68(1).pdf
    oddpages_part69(1).pdf
    oddpages_part7(1).pdf
    oddpages_part70(1).pdf
    oddpages_part71(1).pdf
    oddpages_part72(1).pdf
    oddpages_part73(1).pdf
    oddpages_part74(1).pdf
    oddpages_part8(1).pdf
    oddpages_part9(1).pdf

 

2. boost 的编译安装

Posted by haifeng on 2022-02-17 11:30:20 last update 2022-02-17 11:30:20 | Answers (0) | 收藏


D:\Lib\boost_1_77_0>b2.exe link=static install
Performing configuration checks

    - default address-model    : 64-bit (cached) [1]
    - default architecture     : x86 (cached) [1]
    - compiler supports SSE2   : yes (cached) [2]
    - compiler supports SSE4.1 : yes (cached) [2]
    - has synchronization.lib  : yes (cached) [2]
    - has std::atomic_ref      : no  (cached) [2]
    - has statx                : no  (cached) [2]
    - has statx syscall        : no  (cached) [2]
    - has BCrypt API           : yes (cached) [2]
    - has init_priority attribute : no  (cached) [2]
    - has stat::st_blksize     : no  (cached) [2]
    - has stat::st_mtim        : no  (cached) [2]
    - has stat::st_mtimensec   : no  (cached) [2]
    - has stat::st_mtimespec   : no  (cached) [2]
    - has stat::st_birthtim    : no  (cached) [2]
    - has stat::st_birthtimensec : no  (cached) [2]
    - has stat::st_birthtimespec : no  (cached) [2]
    - cxx11_auto_declarations  : yes (cached) [2]
    - cxx11_constexpr          : yes (cached) [2]
    - cxx11_defaulted_functions : yes (cached) [2]
    - cxx11_final              : yes (cached) [2]
    - cxx11_hdr_mutex          : yes (cached) [2]
    - cxx11_hdr_tuple          : yes (cached) [2]
    - cxx11_lambdas            : yes (cached) [2]
    - cxx11_noexcept           : yes (cached) [2]
    - cxx11_nullptr            : yes (cached) [2]
    - cxx11_rvalue_references  : yes (cached) [2]
    - cxx11_template_aliases   : yes (cached) [2]
    - cxx11_thread_local       : yes (cached) [2]
    - cxx11_variadic_templates : yes (cached) [2]
    - cxx11_auto_declarations  : yes (cached) [3]
    - cxx11_constexpr          : yes (cached) [3]
    - cxx11_defaulted_functions : yes (cached) [3]
    - cxx11_final              : yes (cached) [3]
    - cxx11_hdr_mutex          : yes (cached) [3]
    - cxx11_hdr_tuple          : yes (cached) [3]
    - cxx11_lambdas            : yes (cached) [3]
    - cxx11_noexcept           : yes (cached) [3]
    - cxx11_nullptr            : yes (cached) [3]
    - cxx11_rvalue_references  : yes (cached) [3]
    - cxx11_template_aliases   : yes (cached) [3]
    - cxx11_thread_local       : yes (cached) [3]
    - cxx11_variadic_templates : yes (cached) [3]
    - has_icu builds           : no  (cached) [2]
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam.
note: to suppress this message, pass "--without-graph_parallel" to bjam.
    - zlib                     : no  (cached) [4]
    - bzip2                    : no  (cached) [4]
    - lzma                     : no  (cached) [4]
    - zstd                     : no  (cached) [4]
    - has_lzma_cputhreads builds : no  (cached) [2]
    - cxx11_decltype           : yes (cached) [2]
    - cxx11_basic_alignas      : yes (cached) [2]
    - iconv (libc)             : no  (cached) [2]
    - iconv (separate)         : no  (cached) [2]
    - icu                      : no  (cached) [2]
    - icu (lib64)              : no  (cached) [2]
    - native atomic int32 supported : yes (cached) [2]
    - has message compiler     : yes (cached) [2]
    - native syslog supported  : no  (cached) [2]
    - pthread supports robust mutexes : no  (cached) [2]
    - compiler supports SSSE3  : yes (cached) [2]
    - compiler supports AVX2   : yes (cached) [2]
    - gcc visibility           : no  (cached) [2]
    - sfinae_expr              : yes (cached) [2]
    - cxx11_unified_initialization_syntax : yes (cached) [2]
    - cxx11_hdr_initializer_list : yes (cached) [2]
    - cxx11_hdr_chrono         : yes (cached) [2]
    - cxx11_numeric_limits     : yes (cached) [2]
    - cxx11_hdr_array          : yes (cached) [2]
    - cxx11_hdr_atomic         : yes (cached) [2]
    - cxx11_hdr_type_traits    : yes (cached) [2]
    - cxx11_allocator          : yes (cached) [2]
    - cxx11_explicit_conversion_operators : yes (cached) [2]
    - long double support      : yes (cached) [2]
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
    - cxx11_static_assert      : yes (cached) [2]
    - std::fstream is moveable and swappable : yes (cached) [2]
    - Has Large File Support   : yes (cached) [2]
    - Has attribute init_priority : no  (cached) [2]
    - libbacktrace builds      : no  (cached) [2]
    - libbacktrace builds      : no  (cached) [3]
    - addr2line builds         : no  (cached) [2]
    - addr2line builds         : no  (cached) [3]
    - WinDbg builds            : yes (cached) [2]
    - WinDbg builds            : yes (cached) [3]
    - WinDbgCached builds      : yes (cached) [2]
    - BOOST_COMP_GNUC >= 4.3.0 : no  (cached) [2]
    - compiler supports SSE2   : yes (cached) [5]
    - compiler supports SSE4.1 : yes (cached) [5]
    - has synchronization.lib  : yes (cached) [5]
    - has std::atomic_ref      : no  (cached) [5]
    - has statx                : no  (cached) [5]
    - has statx syscall        : no  (cached) [5]
    - has BCrypt API           : yes (cached) [5]
    - has init_priority attribute : no  (cached) [5]
    - has stat::st_blksize     : no  (cached) [5]
    - has stat::st_mtim        : no  (cached) [5]
    - has stat::st_mtimensec   : no  (cached) [5]
    - has stat::st_mtimespec   : no  (cached) [5]
    - has stat::st_birthtim    : no  (cached) [5]
    - has stat::st_birthtimensec : no  (cached) [5]
    - has stat::st_birthtimespec : no  (cached) [5]
    - cxx11_auto_declarations  : yes (cached) [5]
    - cxx11_constexpr          : yes (cached) [5]
    - cxx11_defaulted_functions : yes (cached) [5]
    - cxx11_final              : yes (cached) [5]
    - cxx11_hdr_mutex          : yes (cached) [5]
    - cxx11_hdr_tuple          : yes (cached) [5]
    - cxx11_lambdas            : yes (cached) [5]
    - cxx11_noexcept           : yes (cached) [5]
    - cxx11_nullptr            : yes (cached) [5]
    - cxx11_rvalue_references  : yes (cached) [5]
    - cxx11_template_aliases   : yes (cached) [5]
    - cxx11_thread_local       : yes (cached) [5]
    - cxx11_variadic_templates : yes (cached) [5]
    - cxx11_auto_declarations  : yes (cached) [6]
    - cxx11_constexpr          : yes (cached) [6]
    - cxx11_defaulted_functions : yes (cached) [6]
    - cxx11_final              : yes (cached) [6]
    - cxx11_hdr_mutex          : yes (cached) [6]
    - cxx11_hdr_tuple          : yes (cached) [6]
    - cxx11_lambdas            : yes (cached) [6]
    - cxx11_noexcept           : yes (cached) [6]
    - cxx11_nullptr            : yes (cached) [6]
    - cxx11_rvalue_references  : yes (cached) [6]
    - cxx11_template_aliases   : yes (cached) [6]
    - cxx11_thread_local       : yes (cached) [6]
    - cxx11_variadic_templates : yes (cached) [6]
    - has_icu builds           : no  (cached) [5]
    - zlib                     : no  (cached) [4]
    - bzip2                    : no  (cached) [4]
    - lzma                     : no  (cached) [4]
    - zstd                     : no  (cached) [4]
    - has_lzma_cputhreads builds : no  (cached) [5]
    - cxx11_decltype           : yes (cached) [5]
    - cxx11_basic_alignas      : yes (cached) [5]
    - iconv (libc)             : no  (cached) [5]
    - iconv (separate)         : no  (cached) [5]
    - icu                      : no  (cached) [5]
    - icu (lib64)              : no  (cached) [5]
    - native atomic int32 supported : yes (cached) [5]
    - has message compiler     : yes (cached) [5]
    - native syslog supported  : no  (cached) [5]
    - pthread supports robust mutexes : no  (cached) [5]
    - compiler supports SSSE3  : yes (cached) [5]
    - compiler supports AVX2   : yes (cached) [5]

3. boost 库中一些库是需要编译的, 比如 filesystem

Posted by haifeng on 2022-02-17 10:42:38 last update 2022-02-17 10:56:43 | Answers (0) | 收藏


D:\Lib\boost_1_77_0>b2.exe --show-libraries
The following libraries require building:
    - atomic
    - chrono
    - container
    - context
    - contract
    - coroutine
    - date_time
    - exception
    - fiber
    - filesystem
    - graph
    - graph_parallel
    - headers
    - iostreams
    - json
    - locale
    - log
    - math
    - mpi
    - nowide
    - program_options
    - python
    - random
    - regex
    - serialization
    - stacktrace
    - system
    - test
    - thread
    - timer
    - type_erasure
    - wave


比如要编译 filesystem 库, 则使用选项 --with-filesystem, 但如果输错会提示.

D:\Lib\boost_1_77_0>b2.exe --with-filesystem -buildtype=complete install
Invalid option: -b

usage: b2.exe [ options ] targets...

-a      Build all targets, even if they are current.
-dx     Set the debug level to x (0-13,console,mi).
-fx     Read x instead of bootstrap.
-jx     Run up to x shell commands concurrently.
-lx     Limit actions to x number of seconds after which they are stopped.
-mx     Maximum target output saved (kb), default is to save all output.
-n      Don't actually execute the updating actions.
-ox     Mirror all output to file x.
-px     x=0, pipes action stdout and stderr merged into action output.
-q      Quit quickly as soon as a target fails.
-sx=y   Set variable x=y, overriding environment.
-tx     Rebuild x, even if it is up-to-date.
-v      Print the version of jam and exit.
--x     Option is ignored.


编译类型选项应该输入 --buildtype  

D:\Lib\boost_1_77_0>b2.exe --with-filesystem -buildtype=complete install

 

D:\Lib\boost_1_77_0\boost\compatibility\cpp_c_headers\cwchar
已复制         1 个文件。
common.copy C:\Boost\include\boost-1_77\boost\compatibility\cpp_c_headers\ctime
D:\Lib\boost_1_77_0\boost\compatibility\cpp_c_headers\ctime
已复制         1 个文件。
common.copy C:\Boost\include\boost-1_77\boost\compatibility\cpp_c_headers\cwctype
D:\Lib\boost_1_77_0\boost\compatibility\cpp_c_headers\cwctype
已复制         1 个文件。
...updated 16179 targets...

 

4. 关于boost之filesystem中样例代码的编译

Posted by haifeng on 2022-02-16 16:44:36 last update 2022-02-17 10:44:20 | Answers (0) | 收藏


D:\Lib\boost_1_77_0\libs\filesystem\example>cl /EHsc /I D:\Lib\boost_1_77_0 ./path_info.cpp
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.29.30140 版
版权所有(C) Microsoft Corporation。保留所有权利。

path_info.cpp
Microsoft (R) Incremental Linker Version 14.29.30140.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:path_info.exe
path_info.obj
LINK : fatal error LNK1104: 无法打开文件“libboost_filesystem-vc142-mt-s-x32-1_77.lib”


 

这是因为 filesystem 库尚未编译.  见问题2901.