0

I'm trying to link my project against a couple of boost libraries and I ran into a 32 vs 64 bit problem.

I'm using Visual Studio 2015. I added path to the built boost libraries to VC++ Directories.

Here's the output I get:

2>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::detach(void)" (?detach@thread@boost@@QAEXXZ)
2>main.obj : error LNK2001: unresolved external symbol "private: bool __thiscall boost::thread::start_thread_noexcept(void)" (?start_thread_noexcept@thread@boost@@AAE_NXZ)
2>main.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ)
2>main.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ)
2>main.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base@detail@boost@@UAE@XZ)

I'm building boost using bootstrap like this:

b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage32

While searching for the solution I opened libboost_thread-vc140-mt-1_64.lib with a text editor and found functions that linker can't find to look like this ?detach@thread@boost@@QEAAXXZ

Some sources explain that QEAAXXZ is a name of a 64-bit compiled function. My linker though expects QAEXXZ (32-bit) as you can see from the output.

Am I building boost correctly for a 32-bit application? If so, why can't my application link against it?

Kirill Daybov
  • 480
  • 3
  • 19
  • I bet its environment related, which is hard to resolve on a Q&A site. Have you followed this tutorial to the tee? There is a section on how to configure Visual Studio for boost linkage http://www.boost.org/doc/libs/1_55_0/more/getting_started/windows.html – IsakBosman Jun 12 '17 at 19:46
  • @kryptogeek pretty much. Tutorial doesn't cover 32, 64 bit compilation differences though. If I build boost using address-model=64 and compile my app using x64 platform, it links successfully. – Kirill Daybov Jun 13 '17 at 21:21

0 Answers0