[Boost] several simple notes for Boost

Source: Internet
Author: User

The header file is the library
The most common question for users is "How should I install boost", which is also my biggest concern at the beginning. Boost is doing well and encapsulates most of the implementations in the header file, therefore, some basic boost libraries do not need to be installed. You only need to include the header files in your own programs, of course, the premise is that you copy all the header files used by boost.
How does boost achieve this?
This is because the boost header file (*. HPP) contains templates and inline functions. You can find an HPP file and you will understand it. Therefore, you do not need to go to the static link activity state link binary lib library.
However, some boost libraries still need to generate binary libraries. If you want to use them, you must compile and install them. They are:
Boost. filesystem
Boost. iostreams
Boost. programoptions
Boost. Python
Boost. RegEx
Boost. serialization
Boost. Signals
Boost. Thread
Boost. Wave
Naming rules
Libboost_filesystem-vc80-mt-sgdp-1_42.lib
Prefix: unified as Lib, but only static libraries in windows have lib prefix;
Library name: name of the database starting with "Boost 1". Here it is boost_filesystem;
Compiler identifier: Name and version of the compiler that compiles the library file. Here it is-vc80;
Multi-threaded logo: supports multi-threaded use-MT, does not indicate that multithreading is not supported;
Abi identifier: This identifier is complex and identifies several compilation link options of the boost library;
S: static library ID;
GD: the debug logo;
P: Use stlport instead of the built-in STL Implementation of the compiler;
Version: the version number of the boost library. The decimal point is replaced by a line below. The value here is limit 42;
Extension: It is lib on windows and a or. So on Unix-like operating systems such as Linux.
Several common macros
# Define boost_all_dyn_link
Similarly, boost will include the corresponding lib by default. If you do not want to use the auto-Link Mechanism provided by boost, or do not feel at ease with its automatic link (in fact, you do not have to worry about it), you can define the macro in advance:
# Define boost_all_no_lib
Use the following link:
# Pragma comment (Lib, "boost_thread-vc100-mt-1_46.lib") or
# Pragma comment (Lib, "boost_thread-vc100-mt.lib ")
The two lib libraries are actually the same. I really don't understand why each library needs to be copied during boost compilation. Is it because the latter does not need to change the code after upgrading the boost version? There is also a useful macro:
# Define boost_lib_diagnostic
It allows VC to specify the boost Library and the link sequence in the output window during compilation.
How to accelerate boost Compilation
You can use the pre-compiled header to solve this problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.