我对 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/