|
Boost : |
From: Christopher Sewell (chrissewell_at_[hidden])
Date: 2002-06-03 12:31:35
I recently downloaded the boost_all.tar.gz file and tried to execute an
example program from the graph library documentation. (I'm including the
code at the bottom of this message, but I don't think it is the problem.) I
am using gcc 3.1 in the console window with Red Hat, using the command
gcc -I ~/boost_1_28_0/ bgl.cc
I get the error:
/tmp/ccIJ6fE7.o: In function `__static_initialization_and_destruction_0(int,
int
)':
/tmp/ccIJ6fE7.o(.text+0x3e9): undefined reference to
`std::ios_base::Init::Init[
in-charge]()'
/tmp/ccIJ6fE7.o(.text+0x404): undefined reference to
`std::ios_base::Init::~Init
[in-charge]()'
/tmp/ccIJ6fE7.o: In function
`boost::detail::adj_list_gen<boost::adjacency_list<
boost::vecS, boost::vecS, boost::bidirectionalS, boost::no_property,
boost::no_p
roperty, boost::no_property, boost::listS>, boost::vecS, boost::vecS,
boost::bid
irectionalS, boost::no_property, boost::no_property, boost::no_property,
boost::
and so on for about 100 lines.
If I run a program with the same includes as the example program but no code
(main just returns 0), I get the error:
/tmp/ccFgFVaL.o: In function `__static_initialization_and_destruction_0(int,
int)':
/tmp/ccFgFVaL.o(.text+0x35): undefined reference to
`std::ios_base::Init::Init[in-charge]()'
/tmp/ccFgFVaL.o(.text+0x50): undefined reference to
`std::ios_base::Init::~Init
[in-charge]()'
/tmp/ccFgFVaL.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
I also tried building the libraries with bjam, although I don't think that
is necessary for the graph library, but it didn't make any difference. I'm
not very experienced with building things in this environment, so any help
would be much appreciated.
Thanks,
Chris
Code of the example program:
#include <iostream> // for std::cout
#include <utility> // for std::pair
#include <algorithm> // for std::for_each
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
using namespace boost;
int main(int,char*[])
{
typedef std::pair<int, int> E;
const int num_edges = 11;
// writing out the edges in the graph
E edge_array[num_edges] = { E(0,1), E(0,2), E(0,3), E(0,4),
E(2,0), E(3,0), E(2,4), E(3,1),
E(3,4), E(4,0), E(4,1) };
const int num_vertices = 5;
// create a typedef for the Graph type
typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;
// declare a graph object
Graph g(num_vertices);
// add the edges to the graph object
for (int i = 0; i < num_edges; ++i)
add_edge(edge_array[i].first, edge_array[i].second, g);
return 0;
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk