Complete steps to install boost library under linux

Complete steps to install boost library under linux

Preface

The Boost library is a portable, source-code-provided C++ library that serves as a backup for the standard library and is one of the development engines for the C++ standardization process. The Boost library was initiated by members of the C++ Standards Committee Library Working Group, and some of its content is expected to become the next generation of the C++ Standard Library. It has a great influence in the C++ community and is an authentic "quasi" standard library. Boost is platform-independent because of its emphasis on cross-platform and standard C++.

The installation process in Linux is as follows:

Go to the official website to download the latest: http://sourceforge.net/projects/boost/files/boost/1.47.0/ or www.boost.org

1. The simplest method:

apt-cache search boost

Search all boost libraries

Then:

sudo apt-get install libboost-all-dev

Install the corresponding libraries

Second, compile and install,

You need to download the latest version from the official website. The latest version is 1.47.0

1. After downloading, unzip it to /opt/boost_1_47_0

2. Solve dependencies sudo apt-get install python-dev gccxml

If it is still not complete, use apt-cache depends XXXXXXX to check

3. Compile bjam:

 #cd /opt/boost_1_47_0
 #sudo ./bootstrap.sh

Compilation successful

4. Compile boost

 #sudo ./bjam

Start Compiling

It takes about ten minutes.

After compilation:

The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
 /home/terry/Local/boost_1_47_0
The following directory should be added to linker library paths:
 /home/terry/Local/boost_1_47_0/stage/lib

Because I unzipped it to /home/terry/Local/boost_1_46_1

So after compiling, it looks like this

5.Update dynamic link library:

sudo ldconfig

Installation complete

3. Test use:

1. Test code

#cat test.cpp 
#include <boost/lexical_cast.hpp>
#include <iostream>

int main()
{
 using boost::lexical_cast;
 int a = lexical_cast<int>("123456");
 double b = lexical_cast<double>("123.456");
 std::cout << a << std::endl;
 std::cout << b << std::endl;
 return 0;
}

2. Compile and run

--g++ -o test test.cpp
#ls
test test.cpp
# ./test 
123456
123.456

Summarize:

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM.

You may also be interested in:
  • Detailed installation and use of virtuoso database under Linux system
  • Detailed tutorial on installing python3.6 and third-party libraries under Linux
  • A simple method to implement scheduled backup of MySQL database in Linux
  • Python implements the function of capturing packets and storing them in the library under Linux
  • Detailed steps for Linux to back up the database every day and delete data ten days ago
  • Solution to the problem of being unable to remotely connect to the database in Linux
  • Problems with dynamic link library loading path and search path under Linux
  • How to implement import and export mysql database commands under linux
  • How to install and configure the decompressed version of MySQL database under Linux system
  • How to use glog log library in Linux environment

<<:  MySQL replication detailed explanation and simple example

>>:  Handwritten Vue2.0 data hijacking example

Recommend

Develop a vue component that encapsulates iframe

Table of contents 1. Component Introduction 2. Co...

Detailed steps to install MySQL 8.0.27 in Linux 7.6 binary

Table of contents 1. Environmental Preparation 1....

WeChat applet implements SMS login in action

Table of contents 1. Interface effect preview 2.u...

MySQL uses find_in_set() function to implement where in() order sorting

This article introduces a tutorial about how to u...

Solve the abnormal error when building vue environment with webpack

Table of contents First, configure package.json T...

Native JS to implement sharing sidebar

This article shares a sharing sidebar implemented...

Basic tutorial on controlling Turtlebot3 mobile robot with ROS

Chinese Tutorial https://www.ncnynl.com/category/...

How to monitor Linux server status

We deal with Linux servers every day, especially ...

Detailed explanation of Linux less command examples

less file name View File less file name | grep -n...

Web Theory: Don't make me think Reading Notes

Chapter 1 <br />The most important principl...

Summary of MySQL lock related knowledge

Locks in MySQL Locks are a means to resolve resou...

CSS3 to achieve timeline effects

Recently, when I turned on my computer, I saw tha...

25 fresh useful icon sets for download abroad

1. E-Commerce Icons 2. Icon Sweets 2 3. Mobile Ph...

JS implements the snake game

Table of contents 1. Initialization structure 2. ...