2>LINK : 致命错误 LNK1104: 无法打开文件 'libboost_filesystem-vc120-mt-sgd-1_58.lib'

2>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc120-mt-sgd-1_58.lib'

难怪 ...\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' 的 "poor man's" 解决方案)以获得:

> 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 后,我的问题已解决:

当我右键单击 "solution" > 配置管理器 > 更改为发布版本时,我意识到它是没有构建的调试配置,果然如此。问题仍然存在 - 我如何获得那些 libboost_filesystem-vc120-mt-sgd-1_58.lib 构建?

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

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

ABI tag: encodes details that affect the library's interoperability with other compiled code. For each such feature, a single letter is added to the tag:

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.              |