[graph] linking error read_graphviz

Hello,
My aim is to parse the graphviz-dot format with boost.
The two examples from the getting-started web page build fine (in Ubuntu
9.10 and also Windows 7)
Building graph-thingie.cpp in VC9.0 with boost 1.42 gives this error:
example.obj : error LNK2001: unresolved external symbol "bool __cdecl
boost::detail::graph::read_graphviz(class std::basic_string

On Sun, 21 Feb 2010, Tillmann Vogt wrote:
Hello,
My aim is to parse the graphviz-dot format with boost. The two examples from the getting-started web page build fine (in Ubuntu 9.10 and also Windows 7)
Building graph-thingie.cpp in VC9.0 with boost 1.42 gives this error:
example.obj : error LNK2001: unresolved external symbol "bool __cdecl boost::detail::graph::read_graphviz(class std::basic_string
const &,class boost::detail::graph::mutate_graph *)" (?read_graphviz@graph@detail@boost@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVmutate_graph@123@@Z) 1>C:\Users\till\Documents\Visual Studio 2008\Projects\example\Release\example.exe : fatal error LNK1120: 1 unresolved externals The next thing I tried was building the "boost_graph" library separately by executing bjam in libs/graph/build
which generated C:\Program Files (x86)\boost\boost_1_42\bin.v2\libs\graph\build\msvc-9.0\debug\libboost_graph-vc90-mt-1_42.lib and also a .lib in the release folder.
The two new libs seem to be same as in boost/lib/ because they have the same size. So the question is:
Do I really have to build "boost_graph" library separately to use the GraphViz readers, like it says on http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/read_graphviz.html?
Yes. That part of BGL is not header-only.
I tried several compiler options and have all 8 variations of libboost_graph-vc90 ... .lib in /boost/lib, but no idea how the compiler magically choses the right one.
I do not believe it does for BGL. You will need to add -lboost_graph or the equivalent for VC++ to your link flags, plus possibly a -L option pointing to boost/lib.
I don't know what to try next, since I get similar errors on Ubuntu 9.10 (on Ubuntu boost 1.38 is preinstalled).
Make sure you have -lboost_graph -Lboost/lib on your linker command line. That should fix the issue. -- Jeremiah Willcock

Am 21.02.2010 16:13, schrieb Jeremiah Willcock:
I tried several compiler options and have all 8 variations of libboost_graph-vc90 ... .lib in /boost/lib, but no idea how the compiler magically choses the right one.
I do not believe it does for BGL. You will need to add -lboost_graph or the equivalent for VC++ to your link flags, plus possibly a -L option pointing to boost/lib.
I don't know what to try next, since I get similar errors on Ubuntu 9.10 (on Ubuntu boost 1.38 is preinstalled).
Make sure you have -lboost_graph -Lboost/lib on your linker command line. That should fix the issue.
Thanks! Now it works.
In Visual Studio I added libboost_graph-vc90-mt.lib under configuration
properties -> Linker -> command line -> additional options
and also added #include
-- Jeremiah Willcock _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Jeremiah Willcock
-
Tillmann Vogt