简体   繁体   中英

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

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?

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM