我编译了Boost并在Visual C ++项目中使用它。在某些时候,我开始收到以下错误:
1>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-sgd-1_45.lib'
AFAIK我正确设置了链接器配置。我搜索了lib并找到了几个近距离匹配:
$(LIB_BOOST)\stage\lib\libboost_filesystem-vc100-mt-gd-1_45.lib
$(LIB_BOOST)\stage\lib\libboost_filesystem-vc100-mt-gd.lib
$(LIB_BOOST)\stage\lib\libboost_filesystem-vc100-mt-1_45.lib
$(LIB_BOOST)\stage\lib\libboost_filesystem-vc100-mt.lib
$(LIB_BOOST)\bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\threading-multi\libboost_filesystem-vc100-mt-1_45.lib
$(LIB_BOOST)\bin.v2\libs\filesystem\build\msvc-10.0\debug\link-static\threading-multi\libboost_filesystem-vc100-mt-gd-1_45.lib
(注意大多数人缺少's'
缺少的'代表什么?这些类似但不同的库代表什么?虽然我编译了所有的Boost,但我怎么会错过它?
答案 0 :(得分:1)
's'是ABI tags
之一ABI标签:对影响的细节进行编码 图书馆的互操作性 其他编译代码。对于每个这样的 功能,添加一个字母 标签:
Key Use this library when:
s linking statically to the C++ standard library and compiler runtime support libraries.
g using debug versions of the standard and runtime support libraries.
y using a special debug build of Python.
d building a debug version of your code.7
p using the STLPort standard library rather than the default one supplied with your compiler.
n using STLPort's deprecated “native iostreams” feature.8
例如,如果您构建调试 用于的代码版本 调试静态运行时的版本 库和STLPort标准 “本地iostreams”模式下的库, 标签是:-sgdpn。如果没有 以上适用,ABI标签是 ommitted。
答案 1 :(得分:1)
我添加了命令行选项:runtime-link = shared,static 这包括丢失的文件。
希望有所帮助