【问题标题】:2>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc120-mt-sgd-1_58.lib'2>LINK : 致命错误 LNK1104: 无法打开文件 'libboost_filesystem-vc120-mt-sgd-1_58.lib'
【发布时间】:2015-04-22 21:16:15
【问题描述】:

难怪...\boost_1_58_0\stage\lib 中没有这样的文件。我怎样才能得到一个?我只有:

boost_1_58_0\stage\lib\libboost_filesystem-vc120-mt-s-1_58.lib
boost_1_58_0\stage\lib\libboost_filesystem-vc120-s-1_58.lib

在那里。尝试使用各种选项编译 boost,最终将 --build-type=complete 添加到它(Linker error LNK1104 with 'libboost_filesystem-vc100-mt-s-1_49.lib' 的“穷人”解决方案)以获得:

> b2 toolset=msvc threadapi=win32 link=static runtime-link=static \
variant=release address-model=32 --with-filesystem --with-locale --with-regex \
--with-system --with-iostreams --build-type=complete

我正在导入的项目的自述文件中建议的命令行 - 仍然没有乐趣。这是一个 CMake 项目,我为构建 MSVS 解决方案付出了一些努力。

注意:仔细查看 CMake gui 后,我的问题得到了解决:

我意识到这是调试配置没有构建,当我右键单击“解决方案”>配置管理器>更改为发布构建时,果然没问题。问题仍然存在 - 我如何获得那些 libboost_filesystem-vc120-mt-sgd-1_58.lib 构建?

【问题讨论】:

    标签: boost cmake msvc12


    【解决方案1】:

    您需要在 b2 命令行参数中包含 runtime-link=static runtime-debugging=on variant=debug 才能获得 sgd。

    来自boost docs 关于 Windows 上的库命名(特别是 ABI 标记部分):

    ABI 标记:对影响库与其他编译代码的互操作性的细节进行编码。对于每个这样的功能,标签中都会添加一个字母:

    Key  |  Use this library when:                                |  Boost.Build option
    =====================================================================================
     s   |  linking statically to the C++ standard library and    |  runtime-link=static
         |  compiler runtime support libraries.                   | 
    -------------------------------------------------------------------------------------
     g   |  using debug versions of the standard and runtime      |  runtime-debugging=on
         |  support libraries.                                    |
    -------------------------------------------------------------------------------------
     y   |  using a special debug build of Python.                |  python-debugging=on
    -------------------------------------------------------------------------------------
     d   |  building a debug version of your code.                |  variant=debug
    -------------------------------------------------------------------------------------
     p   |  using the STLPort standard library rather than the    |  stdlib=stlport
         |  default one supplied with your compiler.              |
    

    【讨论】:

    • 哇,谢谢 - variant=release 和 variant=debug 是专有的吗?换句话说,只需在上面的命令行中添加runtime-debugging=on variant=debug 就足够了(我已经有了runtime-link=static)
    • 我认为如果你完全离开variant,它会默认构建调试和发布。我也认为(不确定)它在构建调试版本时默认选择runtime-debugging=on。基本上,尝试在没有 variant 标志的情况下运行您的原始命令。
    • 删除了variant 并确实添加了C:\_\boost_1_58_0\stage\lib\libboost_filesystem-vc120-mt-sgd-1_58.lib C:\_\boost_1_58_0\stage\lib\libboost_filesystem-vc120-sgd-1_58.lib - (比其他变体大4倍) - 关闭:)
    • 嗨,如何在 Visual Studio 2013 属性中设置这些命令参数?这些选项是否存在于从命令行运行之外?
    猜你喜欢
    • 1970-01-01
    • 2018-04-07
    • 2015-09-17
    • 2011-06-14
    • 2014-11-01
    • 2017-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多