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

Example of using CSS3 to achieve shiny font effect when unlocking an Apple phone

0. Introduction August 18, 2016 Today, I noticed ...

Use of Linux network configuration tools

This article introduces RHEL8 network services an...

Docker cleanup environment operation

Start cleaning carefully! List unused volumes doc...

Analysis of the principle of centering elements with CSS

It is a very common requirement to set the horizo...

MySQL horizontal and vertical table conversion operation implementation method

This article uses examples to illustrate how to i...

UDP DUP timeout UPD port status detection code example

I have written an example before, a simple UDP se...

Front-end JavaScript thoroughly understands function currying

Table of contents 1. What is currying 2. Uses of ...

How to use the concat function in mysql

As shown below: //Query the year and month of the...

WeChat applet uses canvas to draw clocks

This article shares the specific code of using ca...

Pure CSS to achieve automatic rotation effect of carousel banner

Without further ado, let’s get straight to the co...

Solution to 1045 error when navicat connects to mysql

When connecting to the local database, navicat fo...

Detailed explanation of mysql trigger example

Table of contents What is a trigger Create a trig...