2014-03-31 101 views
1

我很新的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

+0

我算在'的boost :: adjacency_list' 7个模板参数,但您提供6.认为自己可能会错过'EdgeList' –

+0

我仍然得到同样的错误提供了一个额外的参数'listS' – unekwu

回答

1

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

它编译如下是我与升压1_55 Ubuntu的盒子

+0

它现在编译。谢谢 – unekwu