Boost库学习笔记(一)安装与配置
来源:http://www.tudoupe.com时间:2022-08-03
Boost库学习笔记(1)安装和配置
1.领取奖金
https://www.boost.org/users/history/version_1_79_0.html
任选其一
boost的目录结构:
tip:
- 启动库的根目录应设置为环境变量**$BOOST_ROOT**,作者路径为(D:Softwareboost_1_79_0)
- 当编译启动程序时,您需要添加启动的头文件目录,作者的路径是(D:Softwareboost_1_79_0boost)
仅头文件的库:
大多数提升库只包含标题,这意味着标题文件已经包含模板和内部链接的功能,不需要单独编译或在链接时特别处理。
当然,有些图书馆需要单独编译,以便使用:
还有少数单独编译的版本:
- Boost.Graph also has a binary component that is only needed if you intend to parse GraphViz files .
- Boost.Math has binary components for the TR1 and C99 cmath functions.
-
Boost.Random
has a binary component which is only needed if you’re using
random_device
. - Boost.Test can be used in “header-only” or “separately compiled” mode, although separate compilation is recommended for serious use.
- Boost.Exception provides non-intrusive implementation of exception_ptr for 32-bit _MSC_VER==1310 and _MSC_VER==1400 which requires a separately-compiled binary. This is enabled by #define BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR.
- Boost.System is header-only since Boost 1.69. A stub library is still built for compatibility, but linking to it is no longer necessary
2.Windows安装过程
使用windows的命令提示符用管理员的权限打开,切换到boost的根目录。
b2程序支持的参数是:
toolset
编译器类,gcc或msvctarget-os
目标操作系统,可以是Windows、Linuxvariant
生成类型,可以是 debug(-gd-)或者release (-)threadapi
线程API的实现可以是win32或pthread,并且在win32中编译link
链接库类型,可以是静态的static,也可以是shared,对应windows上的库就是.lib或者是dllruntime-link
动态还是静态链接C/C++运行时库。同样有shared (-)和static (-s-)两种方式,这样runtime-link和link可以产生4种组合方式,可以根据需要选择编译.prefix
安装路径user-config
用户自定义配置文件,在cross compile的时候可以用来配置编译工具链address-model
生成32位或64位库文件architecture=x86
cpu架构,通用桌面x86,嵌入式平台位置臂
编译和安装64位版本的静态链接库可以执行下列命令: (-mt-s-)
.b2.exe variant=release threading=multi threadapi=win32 link=static runtime-link=static --prefix=E:boost_1_77_0 address-model=64 architecture=x86 install -j8
本段内容可从 https://ww.cnblogs.com/lylygoing/p/BoostDownload.html下载
如果没有指定参数,则在当前目录下生成默认编译。
从输出中可以看出,头条文件是D:Softwareboost_1_79_0
,链接的库的路径在D:Softwareboost_1_79_9stagelib
随后便会生成.v2的目录,大小为2.大约3G,可以直接删除。
3.Linux安装过程
下载
https://www.boost.org/users/history/version_1_79_0.html
4.为VS的翻译做好准备
创建新项目(VS2022)
新建一个源文件
粘贴以下代码
对解决方案进行配置
5.测试运行
每次它将输出你的输入值的3倍
6.要点总结
- 安装的时候先执行bootstrap的脚本文件(Windows执行.bat,Linux执行.sh),之后再执行b2的程序进行编译安装,注意参数可以指定。
- Boost库的主要用途是添加它的标题目录和库目录,任何工具都必须遵循这一原则。
上一篇:B模块windows渗透
相关新闻
- 2022-08-04 WPF的由来
- 2022-08-04 Win11勒索软件防护怎么打开?Win11安
- 2022-08-04 Windows系统jdk的配置
- 2022-08-04 Windows10 OneNote怎么重新登录?如何重
- 2022-08-04 超好用的 Windows 效率工具推荐
- 2022-08-04 Windows如何在CMD或PowerShell中配置代理
- 2022-08-04 powershell和cmd对比
- 2022-08-04 【QT】Windows下QT下载安装
- 2022-08-04 windows下 C++ 实现类属性的get和set方
- 2022-08-04 Win11快速助手在哪里?Win11打开快速
|
|
|
|
|
|
|
|
|
|