博客
关于我
boost1.7 centos7编译
阅读量:762 次
发布时间:2019-03-22

本文共 1100 字,大约阅读时间需要 3 分钟。

Boost安装教程

在环境搭建过程中,以下是具体的安装步骤和注意事项

下载与解压

首先,按照以下步骤完成下载与解压:

1. 从Boost官网(https://boost.org)下载对应版本的源码包

2. 解压后的文件命名可以直接使用包名,如`boost_1_70_0.tar.gz`

3. 在终端中运行:

tar -zxvf boost_1_70_0.tar.gz

这将展开并创建boost安装目录结构

安装Boost

接下来是Boost的安装步骤,下面是具体操作:

1. 输入下列命令进入boost目录:

cd boost_1_70_0/

2. 执行编译命令:

./bootstrap.sh

3. 根据提示输出新的boost安装配置:

./b2 -j5

4. 最后执行安装命令:

./b2 install -j5

完成上述步骤后,检查boost installations完成情况:

验证Boost版本

为了确保安装成功,可以验证当前安装的Boost版本

1. 打开终端并输入命令:

ldconfig -p | grep libboost

2. 或者在源代码文件中查找版本号,比如在`include/boost/`目录下查看文件头部的版本声明

编译测试程序

编写一个简单的测试程序来验证安装是否成功

#include 
#include
using namespace boost::filesystem;int main(int argc, char *argv[]){ // 查看Boost版本信息 printf("Boost version is %s.%d.%d\n", BOOST_VERSION/100000, (BOOST_VERSION/100)%1000, BOOST_VERSION%100); printf("the exe file size : %lld bytes\n", file_size("./test")); return 0;}

编译命令

将上述代码保存为`test.cpp`,然后编译:

g++ -o test test.cpp -lboost_system -lboost_filesystem

注意事项

1. 确认网络连接稳定,因为Boost镜像资源需要下载

2. 如果遇到权限问题,请检查执行权限 Stem

3. 在Windows环境下,默认安装路径为`C:\local`,请根据实际需要进行调整

适用平台

本教程适用于Windows 和Linux双平台,Boost Asio协程在两者均兼容

转载地址:http://gkowk.baihongyu.com/

你可能感兴趣的文章
NMF(非负矩阵分解)
查看>>
nmon_x86_64_centos7工具如何使用
查看>>
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.7 Parameters vs Hyperparameters
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>
No module named 'crispy_forms'等使用pycharm开发
查看>>
No module named cv2
查看>>