我是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错误:为“临时结构增强::属性”提供
在我的代码中,错误指向此行:
boost::property<boost::edge_weight_t,double>
我正在使用该库的1.55版
最佳答案
您似乎包含错误的标题版本。如果检查property.hpp
的路径,则在boost_1_55_0
子树中找不到路径。
它使用Boost 1_55在我的Ubuntu盒子上按原样编译