Boost logo

Boost :

From: Joel Young (jdy_at_[hidden])
Date: 2001-09-03 12:48:19

Thanks that worked.

I am also getting the following:

In file included from
/u/jdy/boost_1_24_0/boost/graph/uniform_cost_search.hpp:173: syntax error before `;'

where line 173 f uniform_cost_search.hpp is:
      PredecessorMap m_predecessor;

and where is:

////cut here////
#include <boost/graph/uniform_cost_search.hpp>

int main(int,char*[])
  return 0;
////cut here////

Also I get an internal compiler error (gcc 2.95.3) with the following stub:

////cut here////
#include <vector>

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>

  typedef boost::property<
            boost::vertex_distance_t, long int,
              boost::vertex_index_t, int,
> vertex_property_t;
  typedef boost::property<
            boost::edge_weight_t, long int,
> edge_property_t;

  typedef boost::adjacency_list<
> basic_graph_t;

int main(int,char*[])
  basic_graph_t graph;

  typedef boost::graph_traits<basic_graph_t>::vertex_descriptor Vertex;
  Vertex rootnode = boost::add_vertex(graph);

  std::vector<Vertex> pred(num_vertices(graph));

  return 0;
////cut here////

jdy.759 ==> g++ -I/u/jdy/boost_1_24_0/ -ftemplate-depth-80 In function `int main(int, char **)': Internal compiler error. Please submit a full bug report. See <URL:> for instructions.

From: Jeremy Siek <jsiek_at_[hidden]>
Date: Mon, 3 Sep 2001 10:57:37 -0500 (EST)
  To: <boost_at_[hidden]>
  Cc: <jdy_at_[hidden]>
Subj: Re: [boost] [BGL] dijkstra-relax-abs

Hi Joel,

Edge weights do not have to be signed types, however, the type you use
must have a version of std::abs() defined for it.

Urgh, the "std::swap() issue" rears its ugly head again!

Here's a couple of possible workarounds:

1. define a std::abs for unsigned int. This is illegal according
to the C++ standard, but will work.

2. I change the std::abs() call in relax to just plain abs() and put a
using std::abs in front. Then you define an abs() for unsigned
int in the global namespace.

I think the better option is 2), so I'll go ahead and make that change.

On Mon, 3 Sep 2001, Joel Young wrote:
jdy> Hi,
jdy> With gcc-2.95.3, if the "edge_weight_t" is "unsigned int" in the
jdy> edge properties, than with dijkstra_shortest_path I get the following
jdy> error:
jdy> .../boost_1_24_0/boost/graph/dijkstra_shortest_paths.hpp:189: instantiated from here
jdy> .../boost_1_24_0/boost/graph/relax.hpp:65: call of overloaded `abs (unsigned int)' is ambiguous
jdy> /usr/include/stdlib.h:699: candidates are: int abs(int)
jdy> .../include/g++-3/cstdlib:17: long int abs(long int)
jdy> .../include/g++-3/cmath:40: float abs(float)
jdy> .../include/g++-3/cmath:42: double abs(double)
jdy> .../include/g++-3/cmath:72: long double abs(long double)
jdy> If I change the edge_weight_t to "long int" for example it build fine.
jdy> Must edge weights be signed types?
jdy> Also, it would be nice if there was an example on using the
jdy> dijkstra_shortest_paths with no external maps.



Jeremy Siek
Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
C++ Booster ( office phone: (812) 855-9761

Boost list run by bdawes at, gregod at, cpdaniel at, john at