[BGL] Trouble linking read_graphviz

Hi.
I have been working through the tutorial portion of "The Boost Graph
Library: User Guide and Reference Manual", and have been unable to
get example code that includes calls to read_graphviz to link. For
example, code including this line:
read_graphviz("figs/ospf-graph.dot", g_dot);
when compiled like this:
g++ -I/usr/local/include//boost-1_37 ospf-example.cpp \
-o ospf /usr/local/lib/libboost_graph-xgcc40-mt-1_37.a
generates the message:
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
boost::read_graphviz(std::basic_string

I have been working through the tutorial portion of "The Boost Graph Library: User Guide and Reference Manual", and have been unable to get example code that includes calls to read_graphviz to link. For example, code including this line: read_graphviz("figs/ospf-graph.dot", g_dot);
However, the test code graphviz.cpp, which has the lines:
std::ifstream in(filename.c_str()); BOOST_REQUIRE(in);
Graph g; dynamic_properties dp; dp.property("id", get(vertex_name, g)); dp.property("weight", get(edge_weight, g)); BOOST_CHECK(read_graphviz(in, g, dp, "id"));
compiles, links, and runs just fine.
I also tried (desperation) building an earlier version of boost -- 1.34.1 -- with the same results.
Any ideas what I'm missing and how I might fix it, or what I need to read to find out, would be appreciated.
I remember having similar problems last time I tried to use the graphviz stuff. Basically, the "parameter-extracting" version that you're calling instantiates a function that doesn't really exist, hence the linker error. You have to be more very specific when calling read_graphviz. and pass in the istream and a dynamic_properties object. I think you can omit the "id" string. I think that gave me some problems too. Andrew Sutton andrew.n.sutton@gmail.com

On Jan 7, 2009, at 6:55 AM, Andrew Sutton wrote:
I remember having similar problems last time I tried to use the graphviz stuff. Basically, the "parameter-extracting" version that you're calling instantiates a function that doesn't really exist, hence the linker error. You have to be more very specific when calling read_graphviz. and pass in the istream and a dynamic_properties object. I think you can omit the "id" string. I think that gave me some problems too.
OK, Thanks. I should probably note that the code that does not link is not code I wrote, but example code that comes with the distribution. -- Michael

On Jan 7, 2009, at 6:55 AM, Andrew Sutton wrote:
I have been working through the tutorial portion of "The Boost Graph Library: User Guide and Reference Manual", and have been unable to get example code that includes calls to read_graphviz to link. For example, code including this line:
read_graphviz("figs/ospf-graph.dot", g_dot);
<...>
Any ideas what I'm missing and how I might fix it, or what I need to read to find out, would be appreciated.
I remember having similar problems last time I tried to use the graphviz stuff. Basically, the "parameter-extracting" version that you're calling instantiates a function that doesn't really exist, hence the linker error. You have to be more very specific when calling read_graphviz. and pass in the istream and a dynamic_properties object. I think you can omit the "id" string. I think that gave me some problems too.
Turns out the answer I looked at this and yet missed it: // Deprecated GraphViz readers void read_graphviz(const std::string& file, GraphvizDigraph& g); void read_graphviz(FILE* file, GraphvizDigraph& g); void read_graphviz(const std::string& file, GraphvizGraph& g); void read_graphviz(FILE* file, GraphvizGraph& g); http://www.boost.org/doc/libs/1_37_0/libs/graph/doc/read_graphviz.html Doh! Mystery solved. -- Michael
participants (2)
-
Andrew Sutton
-
Michael Olea