On Apr 14, 2005, at 11:22 PM, Vivid Yang wrote:
I tried to compile dijkstra-example-listS (BGL CVS) in MSVC 6.0. There were several errors. In the code
tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g);
The variable int edge_array[j].first and edge_array[j].second cannot be converted to descriptors.
To solve this, I have to map int (A, B, C, D, E) to descriptor first: std::pair
maps[5]; int c = 0; graph_traits ::vertex_iterator i, iend; for (tie(i, iend) = vertices(g); i != iend; ++i, ++c) { maps[c] = std::pair (c, *i); }
Yep, the MSVC 6 workaround was broken. I've fixed it in Boost CVS for the next release, but see below for the code if you want to try it yourself.
------------------------------------------------------------------
The same problem happens in dijkstra_shortest_paths.hpp In the lines :
typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end; put(distance, *ui, inf); put(predecessor, *ui, *ui); put(distance, s, zero);
They cannot convert descriptor s and (*ui) from (void *) to int Here is the error description: boost\boost_1_32_0\boost\graph\dijkstra_shortest_paths.hpp(211) : error C2664: 'void __cdecl boost::put(int *,int,const double &)' : cannot convert parameter 2 from 'void *' to 'int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast
If you find where the #if defined(BOOST_MSVC)... line is, replace the
conditional block with:
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
graph_t g(num_nodes);
property_map