【问题标题】:Which library to link for boost::hash_combine为 boost::hash_combine 链接哪个库
【发布时间】:2016-06-12 10:54:38
【问题描述】:

我想在我的项目中使用 boost::hash_combine。但是,我无法找到包含此函数的 boost 库(库 libboost_functional 不存在)。我正在运行 Arch。是否有可能我没有安装所有库?

编辑:

正如 sehe 所指出的,包括正确的标题是关键。

#include <iostream>
#include <boost/functional/hash.hpp>

int main() {
    int x = 100;
    int y = 10;

    size_t h = 0;
    boost::hash_combine(h, x);
    boost::hash_combine(h, y);

    std::cout << h << std::endl;
}

【问题讨论】:

    标签: boost linker


    【解决方案1】:

    路加福音 24:5:

    “你为什么在死人中寻找活人?”

    大多数提升都是仅标题。没有什么可以链接的。在 hash-combine 的情况下,一切都是模板,所以没有什么可以从头文件中隐藏。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-24
      • 2015-07-05
      • 2012-05-03
      • 1970-01-01
      • 2012-12-10
      • 2014-12-22
      • 2017-05-14
      • 2014-05-18
      相关资源
      最近更新 更多