How do I specify, which version of boost library to link to?

﹥>﹥吖頭↗ 提交于 2019-11-26 21:34:51

问题


I'm trying to migrate a project written in VS2012 to VS2013.

I successfully compiled boost 1.53.0 (I first tried 1.54.0, but got some compiler errors) and got libraries like libboost_filesystem-vc120-mt-1_53.lib.

But when trying to build my project, the linker complains:

error LNK1104: cannot open file 'libboost_filesystem-vc110-mt-1_53.lib'

I've been looking for some project settings in my entire solution to find out, why it's trying to load the older library version, but I didn't find anything.

How does the linker know, which library to use? And how can I fix my problem?


回答1:


I found the answer to my question and the solution to my problem in TheArtTrooper's answer to this thread:

How do I build boost with new Visual Studio 2013 preview?

The linker does know which library to use, because it is specified in boost/config/auto_link.hpp.

This file is missing a few lines of code to handle the vc120 version:

#  elif defined(BOOST_MSVC) && (BOOST_MSVC < 1800)

     // vc11:
#    define BOOST_LIB_TOOLSET "vc110"

#  elif defined(BOOST_MSVC)

     // vc12:
#    define BOOST_LIB_TOOLSET "vc120"

Now it compiles and links just fine!



来源:https://stackoverflow.com/questions/19817163/how-do-i-specify-which-version-of-boost-library-to-link-to

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