$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [graph] linking error read_graphviz
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-02-21 10:13:39
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<char,struct 
> std::char_traits<char>,class std::allocator<char> > const &,class 
> boost::detail::graph::mutate_graph *)" 
> (?read_graphviz_at_graph@detail_at_boost@@YA_NABV?$basic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_D@2@@std@@PAVmutate_graph_at_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