How do I specify, which version of boost library t

2020-02-01 04:09发布

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条回答
够拽才男人
2楼-- · 2020-02-01 04:52

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!

查看更多
登录 后发表回答