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 the boost library in a linux environment

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Today, I will talk to you about how to install the boost library in the linux environment, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

Preface

Boost library is a portable, source code C++ library, as the backup of the standard library, is one of the development engines of C++ standardization process. The Boost library is initiated by members of the working Group of the C++ Standards Committee, and some of its content is expected to become the next generation of C++ standard library. It has a great influence in the C++ community, and it is a real "quasi" standard library. Because of its emphasis on cross-platform, Boost's emphasis on C++ has nothing to do with the writing platform.

First, the easiest way:

Apt-cache search boost

All boost libraries were found.

Then:

Sudo apt-get install libboost-all-dev

Install the appropriate library

Second, compile and install

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

1. Decompress to / opt/boost_1_47_0 after download

two。 Resolve dependency sudo apt-get install python-dev gccxml

If it's not complete, use apt-cache depends XXXXXXX to check it.

3. Compile bjam:

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

Compiled successfully

4. Compile boost

# sudo. / bjam

Start compilation

It takes about ten minutes.

After the compilation is complete:

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

Because I decompressed it to / home/terry/Local/boost_1_46_1.

So when it's compiled, here's how it works.

5.update dynamic link library:

Sudo ldconfig

Installation completed

Third, the test uses:

1. Test code

# cat test.cpp # include # include int main () {using boost::lexical_cast; int a = lexical_cast ("123456"); double b = lexical_cast ("123.456"); std::cout

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

Servers

Wechat

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

12
Report