【问题标题】:Linking Libtorrent statically with Visual Studio静态链接 Libtorrent 与 Visual Studio
【发布时间】:2015-02-21 13:46:05
【问题描述】:

我正在尝试将 Libtorrent 与 Visual Studio 2013 静态链接,但在构建 Libtorrent 然后编译我的项目后,我不断收到这个错误:

 LINK : fatal error LNK1104: cannot open file 'libboost_system-vc120-mt-1_55.lib'

由于我是静态构建的,所以我没有 libboost_system-vc120-mt-1_55.lib 而我有 libboost_system-vc120-mt-s-1_55.lib。我使用以下参数构建了提升:

 "toolset=msvc-12.0 variant=release link=static runtime-link=static --with-date_time --with-system --with-thread"

和带有这些的 Libtorrent:

 "toolset=msvc-12.0 boost=source boost-link=static geoip=off encryption=tommath link=static dht=on logging=none statistics=off i2p=on variant=release"

当构建的 Libtorrent 认为它是共享的而不是静态的时,我缺少什么?

【问题讨论】:

    标签: c++ boost visual-studio-2013 libtorrent-rasterbar


    【解决方案1】:

    您在构建boost 时指定了runtime-link=static。这意味着您需要 libtorrent 和您的应用程序(以及您可能使用的任何其他库)也静态链接到 C++ 运行时库。

    因此,您需要将runtime-link=static 添加到libtorrent 的构建命令行,并为您的应用程序选择适当的VC++ 编译器选项(/MT 命令行选项或@ 下相应的Runtime Library 选项987654328@ 在 IDE 中)。

    否则,即使您以某种方式编译了整个内容,也会出现一些严重的运行时错误,因为您的程序的一部分将使用运行时的静态版本,而另一部分将使用共享的运行时。

    【讨论】:

      猜你喜欢
      • 2011-02-26
      • 1970-01-01
      • 2018-08-09
      • 2021-05-11
      • 2011-06-15
      • 1970-01-01
      • 1970-01-01
      • 2011-02-20
      • 2012-09-30
      相关资源
      最近更新 更多