c++ - Boost:错误的模板参数数量

标签 c++ boost

我对 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 版的库

最佳答案

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

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

关于c++ - Boost:错误的模板参数数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22762075/

相关文章:

c++ - 在 C++ 中调用继承的类特定函数

c++ - 类型之间是否有类型特征检查包含?

c++ - 废除 C++ 中的包含文件

C++:不允许 void 的部分函数特化 - 替代解决方案?

c++ - 使用和重载基类的模板成员函数?

c++ - Boost multi_array 范围编译

c++ - 在 'if' 条件中定义 fstream

c++ - 这是正确的行为吗?

c++ - Boost ptree 数字数组

c++ - 无法将参数 1 从 'overloaded-function' 转换为 '...'