Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install boost 1.69library under Linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install boost 1.69 library under Linux, the content is detailed and easy to understand, the operation is simple and fast, and has certain reference value. I believe everyone will have some gains after reading this article on how to install boost 1.69 library under Linux. Let's take a look at it.

Boost library is some extended functions for C++ language standard library, including algorithm library, template metaprogramming, data structure library, image processing library, iterator library, input and output library, which can greatly improve the efficiency of software development.

test platform

Linux version: Ubuntu 18.04 LTS

Boost Version: 1.69.0

1. Install dependency library file linuxidc@linuxidc:~/www.linuxidc.com/Linux Commune-$ sudo apt-get install libbz2-dev[sudo] linuxidc password: reading package list... Completing parsing dependency tree for package Reading status information... Completion will install the following software at the same time: bzip2-doc The following [new] packages will be installed: bzip2-doc libbz2-dev 0 packages upgraded, 2 newly installed, 0 packages to uninstall, 218 packages not upgraded. You need to download 324 kB archive. Decompression consumes 513 kB of extra space. Do you wish to proceed? [Y/n] Y

#Install mpi library

linuxidc@linuxidc:~/www.linuxidc.com/Linux Commune-$ sudo apt-get install libicu-dev Reading package list... Completes the dependency tree for the package being analyzed Reading status information... completed The following software will also be installed: gir1.2-harfbuzz-0.0 icu-devtools libglib2.0-dev libglib2.0-dev-bin libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libicu-le-hb-dev libbicu-le-hb0 libiculx60 libpcre16-3 libpcre 3-dev libpcre32-3 libpcrecpp0v5 Recommended installation: libglib2.0-doc libgraphite2-utils icu-doc The following [new] packages will be installed: gir1.2-harfbuzz-0.0 icu-devtools libglib2.0-dev libglib2.0-dev-bin libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60 libpcre16-3 libpcre 3-dev libpcre32-3 libpcrecpp0v5 0 packages upgraded, 15 packages newly installed, 0 packages to uninstall, There are 218 packages that have not been upgraded. 11.8 MB archive download required. Decompression consumes 57.4 MB of additional space. Do you wish to proceed? [Y/n] Y

#UNICODE character sets that support regular expressions

linuxidc@linuxidc:~/www.linuxidc.com/Linux Public-$ sudo apt-get install Python-dev

#Python is needed

linuxidc@linuxidc:~/www.linuxidc.com/Linux Commune-$ sudo apt-get install libbz2-dev2, Download the installation package sourceforge.net/projects/boost/files/boost/1.69.0/

Here I downloaded boost 1.69, 0 unzipped to a directory

3. CD to this directory

There is a bootstrap.sh script file inside, run this script to run the script:

linuxidc@linuxidc:~/www.linuxidc.com/Linux Commune-/boost_1_69_0$ ./ bootstrap.shBuilding Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2Detecting Python version... 2.7Detecting Python root... /usrUnicode/ICU support for Boost.Regex?... /usrGenerating Boost.Build configuration in project-config.jam... Bootstrapping is done. To build, run: ./ b2 To adjust configuration, edit 'project-config.jam'.Further information: - Command line help: ./ b2 --help - Getting started guide:

According to the above diagram prompt, carry out compilation operation.

4. Start compiling boost

Compiling takes a little time, go jump rope, fight boxing, enter the command:

linuxidc@linuxidc:~/www.linuxidc.com/Linux Commune-/boost_1_69_0$ ./ b2Performing configuration checks - default address-model : 64-bit - default architecture : x86Building the Boost C++ Libraries. - C++11 mutex : yes - lockfree boost::atomic_flag : yes - Boost.Config Feature Check: cxx11_auto_declarations : yes - Boost.Config Feature Check: cxx11_constexpr : yes - Boost.Config Feature Check: cxx11_defaulted_functions : yes - Boost.Config Feature Check: cxx11_final : yes - Boost.Config Feature Check: cxx11_hdr_mutex : yes - Boost.Config Feature Check: cxx11_hdr_tuple : yes - Boost.Config Feature Check: cxx11_lambdas : yes

The screenshot after successful compilation is as follows:

5. Start installation

Install the boost library related files to/usr/local. Enter command:

sudo ./ b2 --prefix=/usr/local/boost install

Screenshot after installation:

Add the boost library to the environment variable. Enter command:

gedit /etc/environment

Add the following path to the file:

CPLUS_INCLUDE_PATH=/usr/local/boost/includeLIBRARY_PATH=/usr/local/boost/lib

After the addition is complete, save the operation.

6. Test cases

(1) Writing the code. Enter command:

linuxidc@linuxidc:~/www.linuxidc.com/Linux public-/boost_1_69_0$ gedit linuxidc.com.Boost.cpp

Open the editor, enter the following code and save:

#include #include using namespace std;int main(){ boost::gregorian::date d(boost::gregorian::day_clock::local_day()); cout ". " ". " return 0;}

(2) Code compilation. Enter command:

linuxidc@linuxidc:~/www.linuxidc.com/Linux public-/boost_1_69_0$ g++ -I /usr/local/boost/include -L /usr/local/boost/lib linuxidc.com-o linuxidc.com

(3) Implementation procedures. Enter command:

linuxidc@linuxidc:~/www.linuxidc.com/Linux Commune-/boost_1_69_0$ ./ linuxidc.com2019.Mar.20

screenshot is as follows

About "How to install boost 1.69 library under Linux" The content of this article is introduced here, thank you for reading! I believe everyone has a certain understanding of "how to install boost 1.69 library under Linux" knowledge, if you still want to learn more knowledge, welcome to pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report