Opened 6 years ago

Closed 5 years ago

#12303 closed Bugs (wontfix)

Linker error with boost.locale and operator%

Reported by: andreas.kuechler@… Owned by: Artyom Beilis
Milestone: To Be Determined Component: locale
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

Hi,

I recently updated to boost 1.61 with self-compiled libraries using MSVC2015 with the following build settings

.\bootstrap
.\b2 architecture=x86 toolset=msvc -j 12 --layout=tagged

The libraries are properly compiled but when I link with my application I get the following errors:

(BOOST_AUTO_LINK_TAGGED is defined globally)

libboost_locale-mt-gd.lib(date_time.obj) : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "public: __cdecl boost::thread_exception::thread_exception(int,char const *)" (??0thread_exception@boost@@QEAA@HPEBD@Z)
libboost_locale-mt-gd.lib(generator.obj) : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
libboost_locale-mt-gd.lib(localization_backend.obj) : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
libboost_locale-mt-gd.lib(lcid.obj) : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
libboost_locale-mt-gd.lib(date_time.obj) : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ)
libboost_locale-mt-gd.lib(generator.obj) : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
libboost_locale-mt-gd.lib(localization_backend.obj) : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
libboost_locale-mt-gd.lib(lcid.obj) : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
debug\uniform_initialization.exe : fatal error LNK1120: 2 unresolved externals

I got a minimal working example

#include <boost/locale.hpp>

int main(int argc, char *argv[])
{
  (boost::locale::format(boost::locale::translate("Hello, {1}")) % "World").str();
  return 0;
}

The linker error occurs only if the operator% is used, format and translate alone compile and link fine. The linker error disappear as soon as I add #include <boost/system/error_code.hpp>

Change History (2)

comment:1 by anonymous, 6 years ago

Component: Nonelocale
Owner: set to Artyom Beilis

comment:2 by Artyom Beilis, 5 years ago

Resolution: wontfix
Status: newclosed

It is dependecy problem on Windows, autolinking of not directly dependent libraries works badly

Note: See TracTickets for help on using tickets.