Hi,
when I try to compile the following code it fails, but when I remove the graphviz part of the code it works just fine. Below I've added both my code and the error I get. Am I doing something wrong, or is this a bug in boost? The method ParseDIMECSGraph::ParseGraph simply parses a DIMECS challenge graph.
#include "stdafx.h"
#include "ParseDIMECSGraph.h"
#include
#include
#include
#include
#include
using namespace boost;
int _tmain(int argc, _TCHAR* argv[])
{
typedef adjacency_list> Graph;
typedef graph_traits < Graph >::edge_descriptor edge_descriptor;
Graph g = *ParseDIMECSGraph::ParseGraph("sample.gr");
std::ofstream ofs( "test.dot" );
write_graphviz(ofs, g);
ofs.flush();
ofs.close();
typedef boost::graph_traits < Graph >::vertex_descriptor Vertex;
std::vector<Vertex> predecessor(boost::num_vertices(g));
std::vector<int> distances(boost::num_vertices(g));
Vertex source = vertex(0, g);
Vertex target = vertex(5, g);
property_map::type weightmap = get(edge_weight, g);
property_map::type indexmap = get(vertex_index, g);
boost::dijkstra_shortest_paths( g,
source,
&predecessor[0],
&distances[0],
weightmap,
indexmap,
std::less<int>(),
closed_plus<int>(),
(std::numeric_limits<int>::max)(),
0,
default_dijkstra_visitor());
return 0;
}
------ Build started: Project: kShortestPath, Configuration: Release Win32 ------
1>Compiling...
1>kShortestPath.cpp
1>C:\Program Files (x86)\boost\boost_1_51\boost/xpressive/detail/utility/sequence_stack.hpp(225) : warning C4996: 'std::fill_n': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1> C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\xutility(3073) : see declaration of 'std::fill_n'
1> C:\Program Files (x86)\boost\boost_1_51\boost/xpressive/detail/utility/sequence_stack.hpp(223) : while compiling class template member function 'boost::xpressive::detail::sub_match_impl<BidiIter> *boost::xpressive::detail::sequence_stack<T>::push_sequence(size_t,const T &,boost::xpressive::detail::fill_t)'
1> with
1> [
1> BidiIter=std::_String_const_iterator,
1> T=boost::xpressive::detail::sub_match_impl>
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/xpressive/match_results.hpp(96) : see reference to class template instantiation 'boost::xpressive::detail::sequence_stack<T>' being compiled
1> with
1> [
1> T=boost::xpressive::detail::sub_match_impl>
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/smart_ptr/intrusive_ptr.hpp(96) : see reference to class template instantiation 'boost::xpressive::detail::results_extras<BidiIter>' being compiled
1> with
1> [
1> BidiIter=std::_String_const_iterator
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/smart_ptr/intrusive_ptr.hpp(95) : while compiling class template member function 'boost::intrusive_ptr<T>::~intrusive_ptr(void)'
1> with
1> [
1> T=boost::xpressive::detail::results_extras>
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/xpressive/match_results.hpp(1345) : see reference to class template instantiation 'boost::intrusive_ptr<T>' being compiled
1> with
1> [
1> T=boost::xpressive::detail::results_extras>
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/xpressive/regex_algorithms.hpp(257) : see reference to class template instantiation 'boost::xpressive::match_results<BidiIter>' being compiled
1> with
1> [
1> BidiIter=std::_String_const_iterator
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/graphviz.hpp(71) : see reference to function template instantiation 'bool boost::xpressive::regex_match>(BidiRange &,const boost::xpressive::basic_regex<BidiIter> &,boost::xpressive::regex_constants::match_flag_type,void *)' being compiled
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Alloc=std::allocator<char>,
1> BidiRange=std::string,
1> BidiIter=std::_String_const_iterator
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/graphviz.hpp(262) : see reference to function template instantiation 'std::string boost::escape_dot_stringstd::string(const T &)' being compiled
1> with
1> [
1> T=std::string
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/graphviz.hpp(290) : see reference to function template instantiation 'void boost::write_graphviz>(std::ostream &,const Graph &,VertexPropertiesWriter,EdgePropertiesWriter,GraphPropertiesWriter,VertexID,boost::graph::detail::no_parameter)' being compiled
1> with
1> [
1> Graph=Graph,
1> VertexPropertiesWriter=boost::default_writer,
1> EdgePropertiesWriter=boost::default_writer,
1> GraphPropertiesWriter=boost::default_writer,
1> Property=boost::no_property,
1> Vertex=__w64 unsigned int,
1> VertexID=boost::vec_adj_list_vertex_id_map
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/graphviz.hpp(301) : see reference to function template instantiation 'void boost::write_graphviz(std::ostream &,const Graph &,VertexPropertiesWriter,EdgePropertiesWriter,GraphPropertiesWriter,boost::graph::detail::no_parameter)' being compiled
1> with
1> [
1> Graph=Graph,
1> VertexPropertiesWriter=boost::default_writer,
1> EdgePropertiesWriter=boost::default_writer,
1> GraphPropertiesWriter=boost::default_writer
1> ]
1> .\kShortestPath.cpp(22) : see reference to function template instantiation 'void boost::write_graphviz<Graph>(std::ostream &,const Graph &,boost::graph::detail::no_parameter)' being compiled
1> with
1> [
1> Graph=Graph
1> ]
1>C:\Program Files (x86)\boost\boost_1_51\boost/xpressive/detail/utility/sequence_stack.hpp(113) : warning C4996: 'std::fill_n': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1> C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\xutility(3073) : see declaration of 'std::fill_n'
1> C:\Program Files (x86)\boost\boost_1_51\boost/xpressive/detail/utility/sequence_stack.hpp(99) : while compiling class template member function 'boost::xpressive::detail::sub_match_impl<BidiIter> *boost::xpressive::detail::sequence_stack<T>::grow_(size_t,const T &)'
1> with
1> [
1> BidiIter=std::_String_const_iterator,
1> T=boost::xpressive::detail::sub_match_impl>
1> ]
1>C:\Program Files (x86)\boost\boost_1_51\boost/graph/dijkstra_shortest_paths.hpp(140) : error C2784: 'EdgeIndex boost::detail::get(const boost::detail::csr_edge_index_map &,const boost::detail::csr_edge_descriptor &)' : could not deduce template argument for 'const boost::detail::csr_edge_index_map &' from 'int *__w64 '
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/detail/compressed_sparse_row_struct.hpp(68) : see declaration of 'boost::detail::get'
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/breadth_first_search.hpp(88) : see reference to function template instantiation 'void boost::detail::dijkstra_bfs_visitor::gray_target,const IncidenceGraph>(Edge,Graph &)' being compiled
1> with
1> [
1> UniformCostVisitor=boost::dijkstra_visitor<>,
1> UpdatableQueue=MutableQueue,
1> WeightMap=boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,
1> PredecessorMap=__w64 unsigned int *__w64 ,
1> DistanceMap=int *__w64 ,
1> BinaryFunction=boost::closed_plus<int>,
1> BinaryPredicate=std::less<int>,
1> Directed=boost::directed_tag,
1> Vertex=__w64 unsigned int,
1> IncidenceGraph=Graph,
1> Edge=boost::detail::edge_desc_impl,
1> Graph=Graph
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/breadth_first_search.hpp(105) : see reference to function template instantiation 'void boost::breadth_first_visit(const IncidenceGraph &,SourceIterator,SourceIterator,Buffer &,BFSVisitor,ColorMap)' being compiled
1> with
1> [
1> IncidenceGraph=Graph,
1> Buffer=MutableQueue,
1> BFSVisitor=boost::detail::dijkstra_bfs_visitor,MutableQueue,boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,__w64 unsigned int *__w64 ,int *__w64 ,boost::closed_plus<int>,std::less<int>>,
1> ColorMap=boost::two_bit_color_map>,
1> SourceIterator=__w64 unsigned int *
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/dijkstra_shortest_paths.hpp(333) : see reference to function template instantiation 'void boost::breadth_first_visit,ColorMap>(const IncidenceGraph &,__w64 unsigned int,Buffer &,BFSVisitor,ColorMap)' being compiled
1> with
1> [
1> Graph=Graph,
1> UniformCostVisitor=boost::dijkstra_visitor<>,
1> UpdatableQueue=MutableQueue,
1> WeightMap=boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,
1> PredecessorMap=__w64 unsigned int *__w64 ,
1> DistanceMap=int *__w64 ,
1> BinaryFunction=boost::closed_plus<int>,
1> BinaryPredicate=std::less<int>,
1> ColorMap=boost::two_bit_color_map>,
1> IncidenceGraph=Graph,
1> Buffer=MutableQueue,
1> BFSVisitor=boost::detail::dijkstra_bfs_visitor,MutableQueue,boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,__w64 unsigned int *__w64 ,int *__w64 ,boost::closed_plus<int>,std::less<int>>
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/dijkstra_shortest_paths.hpp(385) : see reference to function template instantiation 'void boost::dijkstra_shortest_paths_no_init(const Graph &,__w64 unsigned int,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistZero,DijkstraVisitor,ColorMap)' being compiled
1> with
1> [
1> VertexListGraph=Graph,
1> DijkstraVisitor=boost::dijkstra_visitor<>,
1> PredecessorMap=__w64 unsigned int *__w64 ,
1> DistanceMap=int *__w64 ,
1> WeightMap=boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,
1> IndexMap=boost::vec_adj_list_vertex_id_map,
1> Compare=std::less<int>,
1> Combine=boost::closed_plus<int>,
1> DistZero=int,
1> ColorMap=boost::two_bit_color_map>,
1> Graph=Graph
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/dijkstra_shortest_paths.hpp(356) : see reference to function template instantiation 'void boost::dijkstra_shortest_paths(const VertexListGraph &,__w64 unsigned int,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistInf,DistZero,DijkstraVisitor,ColorMap)' being compiled
1> with
1> [
1> VertexListGraph=Graph,
1> DijkstraVisitor=boost::dijkstra_visitor<>,
1> PredecessorMap=__w64 unsigned int *__w64 ,
1> DistanceMap=int *__w64 ,
1> WeightMap=boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,
1> IndexMap=boost::vec_adj_list_vertex_id_map,
1> Compare=std::less<int>,
1> Combine=boost::closed_plus<int>,
1> DistInf=std::numeric_limits<int>::_Ty,
1> DistZero=int,
1> ColorMap=boost::two_bit_color_map>
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/dijkstra_shortest_paths.hpp(404) : see reference to function template instantiation 'void boost::dijkstra_shortest_paths(const VertexListGraph &,__w64 unsigned int,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistInf,DistZero,DijkstraVisitor,const boost::bgl_named_params &,boost::graph::detail::no_parameter)' being compiled
1> with
1> [
1> VertexListGraph=Graph,
1> DijkstraVisitor=boost::dijkstra_visitor<>,
1> PredecessorMap=__w64 unsigned int *__w64 ,
1> DistanceMap=int *__w64 ,
1> WeightMap=boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,
1> IndexMap=boost::vec_adj_list_vertex_id_map,
1> Compare=std::less<int>,
1> Combine=boost::closed_plus<int>,
1> DistInf=std::numeric_limits<int>::_Ty,
1> DistZero=int,
1> T=char,
1> Tag=boost::detail::unused_tag_type
1> ]
1> .\kShortestPath.cpp(46) : see reference to function template instantiation 'void boost::dijkstra_shortest_paths,__w64 unsigned int*__w64 ,int*__w64 ,boost::adj_list_edge_property_map,boost::vec_adj_list_vertex_id_mapboost::no_property,Vertex,std::less<_Ty>,boost::closed_plus<T>,std::numeric_limits<int>::_Ty,int>(const VertexListGraph &,__w64 unsigned int,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistInf,DistZero,DijkstraVisitor)' being compiled
1> with
1> [
1> Directed=boost::directed_tag,
1> Value=int,
1> Ref=int &,
1> Vertex=__w64 unsigned int,
1> Property=boost::propertyboost::edge_weight_t,int,
1> Tag=boost::edge_weight_t,
1> _Ty=int,
1> T=int,
1> VertexListGraph=Graph,
1> PredecessorMap=__w64 unsigned int *__w64 ,
1> DistanceMap=int *__w64 ,
1> WeightMap=boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,
1> IndexMap=boost::vec_adj_list_vertex_id_map,
1> Compare=std::less<int>,
1> Combine=boost::closed_plus<int>,
1> DistInf=std::numeric_limits<int>::_Ty,
1> DistZero=int,
1> DijkstraVisitor=boost::dijkstra_visitor<>
1> ]
1>C:\Program Files (x86)\boost\boost_1_51\boost/graph/dijkstra_shortest_paths.hpp(140) : error C2784: 'EdgeIndex boost::detail::get(const boost::detail::csr_edge_index_map &,const boost::detail::csr_edge_descriptor &)' : could not deduce template argument for 'const boost::detail::csr_edge_index_map &' from 'int *__w64 '
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/detail/compressed_sparse_row_struct.hpp(68) : see declaration of 'boost::detail::get'
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/breadth_first_search.hpp(45) : see reference to function template instantiation 'void boost::detail::dijkstra_bfs_visitor::gray_target,Graph>(Edge,Graph &)' being compiled
1> with
1> [
1> UniformCostVisitor=boost::dijkstra_visitor<>,
1> UpdatableQueue=MutableQueue,
1> WeightMap=boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,
1> PredecessorMap=__w64 unsigned int *__w64 ,
1> DistanceMap=int *__w64 ,
1> BinaryFunction=boost::closed_plus<int>,
1> BinaryPredicate=std::less<int>,
1> Directed=boost::directed_tag,
1> Vertex=__w64 unsigned int,
1> Graph=Graph,
1> Edge=boost::detail::edge_desc_impl
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/breadth_first_search.hpp(37) : while compiling class template member function 'void boost::BFSVisitorConcept::constraints(void)'
1> with
1> [
1> Visitor=boost::detail::dijkstra_bfs_visitor,MutableQueue,boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,__w64 unsigned int *__w64 ,int *__w64 ,boost::closed_plus<int>,std::less<int>>,
1> Graph=Graph
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/concept/detail/has_constraints.hpp(42) : see reference to class template instantiation 'boost::BFSVisitorConcept' being compiled
1> with
1> [
1> Visitor=boost::detail::dijkstra_bfs_visitor,MutableQueue,boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,__w64 unsigned int *__w64 ,int *__w64 ,boost::closed_plus<int>,std::less<int>>,
1> Graph=Graph
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/concept/detail/msvc.hpp(53) : see reference to class template instantiation 'boost::concepts::not_satisfied<Model>' being compiled
1> with
1> [
1> Model=boost::BFSVisitorConcept,MutableQueue,boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,__w64 unsigned int *__w64 ,int *__w64 ,boost::closed_plus<int>,std::less<int>>,Graph>
1> ]
1> C:\Program Files (x86)\boost\boost_1_51\boost/graph/breadth_first_search.hpp(68) : see reference to class template instantiation 'boost::concepts::require<Model>' being compiled
1> with
1> [
1> Model=boost::BFSVisitorConcept,MutableQueue,boost::adj_list_edge_property_mapboost::edge_weight_t,int,boost::edge_weight_t>,__w64 unsigned int *__w64 ,int *__w64 ,boost::closed_plus<int>,std::less<int>>,Graph>
1> ]
1>kShortestPath - 2 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========