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

时间:2015-04-22 21:16:16

标签: boost cmake msvc12

难怪因为...\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
在那里。尝试使用各种选项编译提升,最后将--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时,问题解决了:

enter image description here

我意识到,当我右键单击“解决方案”>时,调试配置无法构建且确定无疑。配置管理器>更改为发布版本一切正常。问题仍然存在 - 如何获得libboost_filesystem-vc120-mt- sgd -1_58.lib构建?

1 个答案:

答案 0 :(得分:12)

您需要在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.              |