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 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:
|
<<: MySQL replication detailed explanation and simple example
>>: Handwritten Vue2.0 data hijacking example
Regarding uninstalling the previously installed v...
0. Introduction August 18, 2016 Today, I noticed ...
This article introduces RHEL8 network services an...
Table of contents 1. Steps to use Jquery: (1) Imp...
Start cleaning carefully! List unused volumes doc...
It is a very common requirement to set the horizo...
This article uses examples to illustrate how to i...
I have written an example before, a simple UDP se...
Table of contents 1. What is currying 2. Uses of ...
As shown below: //Query the year and month of the...
This article shares the specific code of using ca...
Without further ado, let’s get straight to the co...
This is what happened. Today I was playing with G...
When connecting to the local database, navicat fo...
Table of contents What is a trigger Create a trig...