boost 高手帮忙看看,vc6上编不过

Xcoder 2006-06-01 06:27:48
#include "stdafx.h"

#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/kamada_kawai_spring_layout.hpp>
#include <map>

typedef struct tag_position_t{
float x;
float y;
}position_t;

int main()
{
using namespace boost;
using namespace std;
typedef adjacency_list < vecS, vecS, undirectedS,
property<vertex_distance_t, int>, property < edge_weight_t, int > > Graph;
typedef std::pair < int, int >E;
const int num_nodes = 5;
E edges[] = { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3),
E(3, 4), E(4, 0)
};
int weights[] = { 1, 1, 2, 7, 3, 1, 1 };

Graph g(num_nodes);
property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g);
for (std::size_t j = 0; j < sizeof(edges) / sizeof(E); ++j)
{
graph_traits<Graph>::edge_descriptor e; bool inserted;
tie(e, inserted) = add_edge(edges[j].first, edges[j].second, g);
weightmap[e] = weights[j];
}
map< position_t, vertex_index_t> position;

kamada_kawai_spring_layout(g, position, weightmap, boost::edge_length(1.0));
return 0;
}


提示4个重载函数都参数不匹配。还有一个重载函数参数个数应该匹配的,但也没什么错误信息。郁闷。
谢谢了!
...全文
489 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
昊叔 2006-06-17
  • 打赏
  • 举报
回复
boost的测试是在VC7上的
fuyer 2006-06-15
  • 打赏
  • 举报
回复
那用vc7试试吧。
vc8都出来了,大家还在用十年前的vc6!
bufan2162 2006-06-13
  • 打赏
  • 举报
回复
原来好多C得开发工具哦!!!
不知哪个最好?
roger_77 2006-06-07
  • 打赏
  • 举报
回复
Graph 这个类库偶还没用过,不了解。

帮顶下
happytang 2006-06-02
  • 打赏
  • 举报
回复
Graph是个处理图(graph)结构的库,它的设计在很大程度上受到STL的影响。
boost中不是所有的库都能用吧
Xcoder 2006-06-02
  • 打赏
  • 举报
回复
to fengfeng2003:
我就是要试验 kamada_kawai_spring_layout这个函数啊,这个算法大概是图布局用的,你把#include <boost/graph/kamada_kawai_spring_layout.hpp>注释掉,这个函数能用么?
积木 2006-06-02
  • 打赏
  • 举报
回复
vc6对模板支持不完整。。
fengfeng2003 2006-06-02
  • 打赏
  • 举报
回复
偶的是boost_1_30_0,没有这个头文件
fengfeng2003 2006-06-01
  • 打赏
  • 举报
回复
#include <boost/graph/kamada_kawai_spring_layout.hpp>

不知道这个是做什么,boost的graph我用过,我把这个注释掉,编译通过了啊

我用的vc6,打补丁的,不知道你用的什么编译器

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧