简体   繁体   English

Boost:模板参数数量错误

[英]Boost: wrong number of template arguments

I'm pretty new to c++ and boost library: Not sure what I'm doing wrong in the following code: I'm following the example found here http://www.richelbilderbeek.nl/CppBoostGraphExample4.htm 我对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;

When I try to compile the code I get 当我尝试编译代码时,我得到了

error: wrong number of template arguments (1, should be 3) /usr/include/boost/pending/property.hpp:22 error: provided for 'tempate struct boost::property' 错误:模板参数数量错误(1,应为3)/usr/include/boost/pending/property.hpp:22错误:为“临时结构增强::属性”提供

In my code the error is pointing to this line: 在我的代码中,错误指向此行:

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

I'm using version 1.55 of the library 我正在使用该库的1.55版

You seem to be including the wrong version of the header. 您似乎包含错误的标题版本。 If you check the path to property.hpp it doesn't find a path in the boost_1_55_0 subtree. 如果检查property.hpp的路径,则在boost_1_55_0子树中找不到路径。

It compiles as is on my Ubuntu box with Boost 1_55 它使用Boost 1_55在我的Ubuntu盒子上按原样编译

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM