【问题标题】:Boost: wrong number of template argumentsBoost:模板参数的数量错误
【发布时间】:2014-03-31 12:54:03
【问题描述】:

我对 c++ 和 boost 库还很陌生: 不确定我在以下代码中做错了什么: 我正在关注此处的示例http://www.richelbilderbeek.nl/CppBoostGraphExample4.htm

 typedef boost::adjacency_list
  <
    //Store all edges as a std::vector
    boost::vecS,
    //Store all vertices in a std::vector
    boost::vecS,
    //Relations are both ways (in this example)
    //(note: but you can freely change it to boost::directedS)
    boost::undirectedS,
    //All vertices are person names of type std::string
    boost::property<boost::vertex_name_t,std::string>,
    //All edges are weights equal to the encounter frequencies
    boost::property<boost::edge_weight_t,double>,
    //Graph itself has a std::string name
    boost::property<boost::graph_name_t,std::string>
 > Graph;

当我尝试编译我得到的代码时

错误:模板参数的数量错误(1,应该是 3) /usr/include/boost/pending/property.hpp:22 错误:为“tempate struct boost::property”提供

在我的代码中,错误指向这一行:

boost::property<boost::edge_weight_t,double>

我使用的是 1.55 版的库

【问题讨论】:

  • 我在boost::adjacency_list 中计算了7 个模板参数,但您提供了6 个。认为您可能会错过EdgeList
  • 我仍然得到同样的错误提供一个额外的参数listS

标签: c++ boost


【解决方案1】:

您似乎包含了错误版本的标题。如果您检查property.hpp 的路径,它不会在boost_1_55_0 子树中找到路径。

它在我的带有 Boost 1_55 的 Ubuntu 机器上按原样编译

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-08
    • 2019-02-25
    • 2017-07-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多