Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Why my application fails to link with Boost.Log? What's the fuss about library namespaces?

The library declares the boost::log namespace which should be used in client code to access library components. However, internally the library uses another nested namespace for actual implementation. The namespace name is configuration and platform dependent, it can change between different releases of the library, so it should never be used in the user side code. This is done in order to make the library configuration synchronized with the application as much as possible and eliminate problems caused by configuration mismatch.

Most of the time users won't even notice the existence of this internal namespace, but it often appears in compiler and linker errors and in some cases it is useful to know how to decode its name. Currently, the namespace name is composed from the following elements:

<version><linkage>_<threading>_<system>

As a couple quick examples, v2s_st corresponds to v2 static single-threaded build of the library and v2_mt_posix - to v2 dynamic multi-threaded build for POSIX system API.

Namespace mangling may lead to linking errors if the application is misconfigured. One common mistake is to build dynamic version of the library and not define BOOST_LOG_DYN_LINK or BOOST_ALL_DYN_LINK when building the application, so that the library assumes static linking by default. Whenever such linking errors appear, one can decode the namespace name in the missing symbols and the exported symbols of Boost.Log library and adjust library or application configuration accordingly.


PrevUpHomeNext