Boost logo

Boost :

From: Sam Rash (rash3_at_[hidden])
Date: 2002-05-31 11:45:57


I have downloaded and built boost 1.28 for solaris 2.8 box. I am trying to
compile the test program below (taken from the documentation)
I execute the following compile command and get the error:
(gcc 2.95.2)

genome:/boost_test> g++ -o test test.cc -I/home/rash/install/boost_1_28_0/
In file included from
/home/rash/install/boost_1_28_0/boost/random/mersenne_twister.hpp:29,
                 from
/home/rash/install/boost_1_28_0/boost/graph/graph_utility.hpp:43,
                 from
/home/rash/install/boost_1_28_0/boost/graph/detail/adjacency_list.hpp:43,
                 from
/home/rash/install/boost_1_28_0/boost/graph/adjacency_list.hpp:293,
                 from test.cc:26:
/home/rash/install/boost_1_28_0/boost/integer_traits.hpp:109: #error No
WCHAR_MIN and WCHAR_MAX present, please adjust integer_traits<> for your
compiler.

I have noted the "fail" marker on the compiler status page for this
compiler/OS. However, I have been unable to find anything saying what can
be changed to remedy the situation. Does anyone have any tips?

--------
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
using namespace boost;

template < typename UndirectedGraph > void
undirected_graph_demo1()
{
  const int V = 3;
  UndirectedGraph undigraph(V);
  typename graph_traits < UndirectedGraph >::vertex_descriptor zero, one,
two;
  typename graph_traits < UndirectedGraph >::out_edge_iterator out, out_end;
  typename graph_traits < UndirectedGraph >::in_edge_iterator in, in_end;

  zero = vertex(0, undigraph);
  one = vertex(1, undigraph);
  two = vertex(2, undigraph);
  add_edge(zero, one, undigraph);
  add_edge(zero, two, undigraph);
  add_edge(one, two, undigraph);

  std::cout << "out_edges(0): ";
  for (tie(out, out_end) = out_edges(zero, undigraph); out != out_end;
++out)
    std::cout << *out;
  std::cout << std::endl << "in_edges(0): ";
  for (tie(in, in_end) = in_edges(zero, undigraph); in != in_end; ++in)
    std::cout << *in;
  std::cout << std::endl;
}

template < typename DirectedGraph > void
directed_graph_demo()
{
  const int V = 2;
  DirectedGraph digraph(V);
  typename graph_traits < DirectedGraph >::vertex_descriptor u, v;
  typedef typename DirectedGraph::edge_property_type Weight;
  typename property_map < DirectedGraph, edge_weight_t >::type
    weight = get(edge_weight, digraph);
  typename graph_traits < DirectedGraph >::edge_descriptor e1, e2;
  bool found;

  u = vertex(0, digraph);
  v = vertex(1, digraph);
  add_edge(u, v, Weight(1.2), digraph);
  add_edge(v, u, Weight(2.4), digraph);
  tie(e1, found) = edge(u, v, digraph);
  tie(e2, found) = edge(v, u, digraph);
  std::cout << "in a directed graph is ";
#ifdef __GNUC__
  // no boolalpha
  std::cout << "(u,v) == (v,u) ? " << (e1 == e2) << std::endl;
#else
  std::cout << "(u,v) == (v,u) ? "
    << std::boolalpha << (e1 == e2) << std::endl;
#endif
  std::cout << "weight[(u,v)] = " << get(weight, e1) << std::endl;
  std::cout << "weight[(v,u)] = " << get(weight, e2) << std::endl;
}

template < typename UndirectedGraph > void
undirected_graph_demo2()
{
  const int V = 2;
  UndirectedGraph undigraph(V);
  typename graph_traits < UndirectedGraph >::vertex_descriptor u, v;
  typedef typename UndirectedGraph::edge_property_type Weight;
  typename property_map < UndirectedGraph, edge_weight_t >::type
    weight = get(edge_weight, undigraph);
  typename graph_traits < UndirectedGraph >::edge_descriptor e1, e2;
  bool found;

  u = vertex(0, undigraph);
  v = vertex(1, undigraph);
  add_edge(u, v, Weight(3.1), undigraph);
  tie(e1, found) = edge(u, v, undigraph);
  tie(e2, found) = edge(v, u, undigraph);
  std::cout << "in an undirected graph is ";
#ifdef __GNUC__
  std::cout << "(u,v) == (v,u) ? " << (e1 == e2) << std::endl;
#else
  std::cout << "(u,v) == (v,u) ? "
    << std::boolalpha << (e1 == e2) << std::endl;
#endif
  std::cout << "weight[(u,v)] = " << get(weight, e1) << std::endl;
  std::cout << "weight[(v,u)] = " << get(weight, e2) << std::endl;
}

int
main()
{
  typedef property < edge_weight_t, double >Weight;
  typedef adjacency_list < vecS, vecS, undirectedS,
    no_property, Weight > UndirectedGraph;
  typedef adjacency_list < vecS, vecS, directedS,
    no_property, Weight > DirectedGraph;
  undirected_graph_demo1 < UndirectedGraph > ();
  undirected_graph_demo2 < UndirectedGraph > ();
  directed_graph_demo < DirectedGraph > ();
  return 0;
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk