2014-03-31 127 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