【问题标题】:boost linker error wrong toolsetboost链接器错误错误的工具集
【发布时间】:2017-04-06 18:01:33
【问题描述】:

有很多与此相关的问题,但到目前为止,我的情况还没有一个解决方案。 我使用工具集 14.1 使用 VS 2017 构建了 boost 1.63 库

构建boost库的命令行是:

bjam --toolset=msvc-14.1 --build-dir="libs"  --stagedir="x64" --build-type=complete stage  address-model=64 threading=multi link=static runtime-link=static

构建文件夹中的第二个库是

libboost_atomic-vc141-mt-sgd-1_63.lib

我使用 boost 的项目指向这个文件夹。但与 VS 2017 链接 并且选择的工具集 14.1 会引发错误:

LINK : fatal error LNK1104: cannot open file 'libboost_atomic-vc140-mt-sgd-1_63.lib'

如您所见,只有工具集不正确。 是否有额外的开关以及在哪里可以找到?谢谢。

一条评论:我使用 project-config.jam 设置构建了 bjam.exe

using msvc : 14.1;

而且库的构建速度非常快:所有 x64 库都在 20 秒以下!

【问题讨论】:

    标签: c++ boost linker


    【解决方案1】:

    Boost 1.63 尚未与 Visual Studio 2017 兼容,因此您必须手动执行一些操作来修复问题。为了确保它选择正确的库文件,您需要编辑auto_link.hpp,它位于boost/config。更改这些行:

    # elif defined (BOOST_MSVC)
    
         // vc14:
    #  define BOOST_LIB_TOOLSET "vc140"
    

    到这里:

    # elif defined (BOOST_MSVC) && (BOOST_MSVC < 1910)
    
         // vc14:
    #  define BOOST_LIB_TOOLSET "vc140"
    
    # elif defined (BOOST_MSVC)
    
         // vc15:
    #  define BOOST_LIB_TOOLSET "vc141"
    

    然后对 boost 库进行干净的重新编译,并将包含中此文件的原始版本替换为此修改后的版本。

    【讨论】:

      猜你喜欢
      • 2014-01-08
      • 1970-01-01
      • 1970-01-01
      • 2014-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多