Trying to link Boost 1.52 thread

*爱你&永不变心* 提交于 2019-11-27 23:53:42

I had the same problem before: I build boost lib with default parameters which run bootstrap.bat directly.

if you use boost::system in your project, you should use and appoint x86 or x64 version of boost::system lib.

you can recompile boost lib with this bat, save these to boost root folder and run it in CMD windows(don't double click!):

call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86

cd boost_1_60_0
call bootstrap.bat

rem Most libraries can be static libs
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/win32

pause

for more details you can see this article: https://studiofreya.com/2015/12/19/how-to-build-boost-1-60-with-visual-studio-2015/

Thank looks to me like its no auto linking correctly.

Include path is boost152/ only
Library path is boost152/stage/lib
Nicola Pezzotti

Be sure to add the right directories into the linker properties.

Read this post to further details Boost linker error: Unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::get_system_category(void)"

Also you've got to add this path into Linker addition directories:

$(BOOST_ROOT)\bin.v2\libs\thread\build\msvc-xx.0\release\address-model-64\link-static\threading-multi

where xx is your visual studio version

These two defines below were messing up with my linker, throwing one beautiful "LNK2001: unresolved external symbol" error. Do you have then somewhere in your code?

//#define BOOST_FILESYSTEM_NO_DEPRECATED
//#define BOOST_FILESYSTEM_NO_LIB
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!