The geting started on Windows (http://www.boost.org/doc/libs/1_38_0/more/getting_started/windows.html) on the boost official website mentions the name of the boost library, excerpted as follows:
Take libboost_regex-vc71-mt-d-1_34.lib as an example:
- Lib
Prefix: In addition to Microsoft Windows, the name of each boost library starts with this string. On Windows, only common static libraries use the Lib prefix. Import and export libraries and DLL libraries are not used.
- Boost_regex
Library name: All boost library name files start with boost.
- -Vc71
Toolset Tag: identifies the toolset and version used to build the library.
- -MT
Threading flag: indicates that the multi-thread support is enabled for building the library. The multi-threaded library does not support-MT.
- -D
Abi Tag: Code details that affect the interaction between libraries and other compiled code. For each feature, add a letter to the tag:
Key |
Use this library when: |
S |
Static link to C ++ standard library and compiler runtime support library |
G |
Use standard library and runtime support library debugging version |
Y |
Build with special Python debugging |
D |
Build the debugging version of the code |
P |
Use the stlport standard library instead of the default library provided by the compiler |
N |
"Native iostreams" that has been discarded using stlport" |
- -34
Version MARK: the complete boost release number, which is replaced by an underscore. For example, version 1.31.1 is marked as "-000031_1 ".
- . Lib
Extension: Depends on the operating system. On most UNIX platforms,. A is a static library and. So is a shared library. In Windows,. dll indicates the shared library, and. Lib indicates static or imported to the database.
The following table lists the compiled file names of the RegEx database:
File Name |
Description |
Compilation options used to compile programs using this library |
Libboost_regex-vc90-mt-sgd-1_38.lib |
Static library, multi-thread, debugging version Use the static debugging Version C Runtime Library (libcmtd. lib and libcpmtd. Lib) |
/MTD |
Libboost_regex-vc90-mt-s-1_38.lib |
Static library, multi-thread Use the static version C Runtime Library (libcmt. lib and libcpmt. Lib) |
/Mt |
Libboost_regex-vc90-mt-gd-1_38.lib |
Static library, multi-thread, debugging version Use the dynamic debugging Version C Runtime Library (msvcrtd. lib and msvcprtd. Lib) |
/MDD |
Libboost_regex-vc90-mt-1_38.lib |
Static library, multi-thread Use the dynamic Version C Runtime Library (msvcrt. lib and msvcprt. Lib) |
/MD |
Boost_regex-vc90-mt-gd-1_38.lib |
Import warehouse (boost_regex-vc90-mt-gd-1_38.dll), multithreading, debugging version |
|
Boost_regex-vc90-mt-1_38.lib |
Import warehouse (boost_regex-vc90-mt-1_38.dll) Multithreading |
|
Note that when linking, the file name of the RegEx library used must match the compilation option; otherwise, the following link error occurs:
Link: Warning lnk4098: defaultlib '××××' conflicts with use of other libs; Use/nodefaultlib: Library
The original cause is that during compilation, cl.exe (that is, the VC compiler) inserts the corresponding defaultlib file name into the OBJ file compiled based on the above compilation options (using dumpbin/Directive ***, Lib for viewing ), for example,/MT corresponds to libcmt. lib (C) and libcpmt. lib (C ++ standard library ). When the linker processes the OBJ file, the defaultlib file name is retrieved from the file and placed at the end of the command line library list for use. This is also true for the processing of static libraries. static libraries are also composed of some OBJ files, and each OBJ file is embedded with the corresponding defalib lib according to the current compilation options. When the linker processes the static library, it will also put the defaultlib in the involved OBJ file at the end of the command line library list. Assume that our program uses/MT for compilation. The corresponding defaultlib is libcmt. Lib (C) and libcpmt. Lib (C ++ standard library ). The use of libboost_regex-vc90-mt-sgd-1_38.lib, it corresponds to the defaultlib is libcmtd. lib and libcpmtd. Lib. During the link process, the linker will find that different runtime libraries are used, so the above error will occur.
Fortunately, Visual C ++ supports automatic links. When a header file containing RegEx is included, RegEx will define different macros Based on the Compilation options of the current project, for details, refer to the previous C Runtime Library) to automatically tell the Compiler which file to send to the linker.