Serge Kork
Serge Kork

Reputation: 71

Building Boost Log Library

I'm upgrading boost to version 1.81.0 and meet with unresolved dependencies with boost log library. Linker requires the symbols like this:

error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits > & __cdecl boost::log::v2s_mt_nt62::operator<<<char,struct std::char_traits >(class std::basic_ostream<char,struct std::char_traits > &,class boost::log::v2s_mt_nt62::attribute_name const &)

In boost changelog I find a note:

2.23, Boost 1.78 General changes: On Windows, when building the library for Windows 8 or later, the library will use nt62 tag in the version namespace to denote the target OS ABI. For example, the version namespace could be named as v2_mt_nt62. This name will be part of all symbols exported by the library. Use the BOOST_USE_WINAPI_VERSION macro consistently when building Boost and your code to request the minimum target Windows version.

But I'm using the following build command line:

./b2.exe toolset=msvc address-model=64 variant=release link=static threading=multi runtime-link=static --stagedir='./' --cxxflags=/std:c++latest --cxxflags=/D_WIN32_WINNT=0x0A00 --cxxflags=/DBOOST_USE_WINAPI_VERSION=0x0A00

that, in my opinion, pointed out on Windows 10 SDK API version. But DUMPBIN utility output executed on libboost_log-vc143-mt-s-x64-1_81.lib looks like:

void __cdecl boost::log::v2s_mt_nt6::aux::attach_attribute_name_info(class boost::exception &,class boost::log::v2s_mt_nt6::attribute_name const &))

where boost log namespace is 'v2s_mt_nt6'. What am I doing wrong? Andrey Semashev what do you think?

Upvotes: 1

Views: 823

Answers (1)

Andrey Semashev
Andrey Semashev

Reputation: 10614

  1. cxxflags is a Boost.Build feature, not an option. It should have no leading dashes in the command line.
  2. You don't need to specify cxxflags to define macros when building Boost, use define=BOOST_USE_WINAPI_VERSION=0x0A00 instead. define is also a feature, it should also go without leading dashes.
  3. You don't need to use cxxflags to specify the target C++ version. You can use cxxstd=latest instead.
  4. Don't forget to define BOOST_USE_WINAPI_VERSION=0x0A00 when building your code as well.

Upvotes: 1

Related Questions