# Trouble Shooting

With GNU C++, if you see the following error message:

    boost/type_traits/arithmetic_traits.hpp:243: template instantiation depth exceeds maximum of 17
    boost/type_traits/arithmetic_traits.hpp:243:  (use -ftemplate-depth-NN to increase the maximum)

then you need to do as the error message advises and increase the template instantiation depth. Passing the flag `-ftemplate-depth-30` to g++ usually does the trick.

    error C2784: 'T __cdecl source(struct std::pair,const G &)' :
    could not deduce template argument for 'struct std::pair<_T1,_T1>' from
     'class boost::detail::bidir_edge'

VC++ does not support Koenig Lookup, therefore you need to refer to functions defined in the boost namespace using the `boost::` prefix, i.e., `boost::source(e, g)` instead of `source(e, g)`.

    ../../..\boost/property_map.hpp(283) : error C2678: binary '[' : no operator defined
     which takes a left-hand operand of type 'const struct boost::adj_list_edge_property_map,unsigned int,enum boost::edge_weight_t>' (or there is no acceptable conversion)

There is a VC++ bug that appears when using `get(property, graph, edge)`. A workaround is to use `get(get(property, graph), edge)` instead. Note that `boost/property_map.hpp` has now been moved to `boost/property_map/property_map.hpp`.

    C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(59) : fatal
    error C1001: INTERNAL COMPILER ERROR
            (compiler file 'msc1.cpp', line 1786)

There can be many reasons for this error, but sometimes it is caused by using the flag `/Gm` (minimal rebuild). As this flag is not really necessary, it is a good idea to turn it off.

Another reason for the error can be the use of the named-parameter interface for many of the BGL algorithms. Try using the non named-parameter version of the algorithm instead (see the HTML docs for the algorithm in question).

Yet another reason can be the use of the `get()` function of the PropertyGraph interface. Instead of using the `get()` function in a complex expression, always declare a property map variable first:

    property_map<graph_t, edge_weight_t>::type w_map = get(edge_weight, g);
    // use w_map ...

    V:\3rdPARTY\SXL\INCLUDE\xlocnum(309) : error C2587: '_U' : illegal
     use of local variable as default parameter

Workaround from Andreas Scherer:
That's the usual problem with MSVC-- 6.0 sp[34] when compiling some (or all?) of the BGL examples. You can't use the DLL version of the run-time system. I succeeded in compiling file_dependencies.cpp after switching to ``[Debug] Multithreaded'' (section ``Code Generation'' on page ``C/C++'' in the ``Project Settings'').

Another reason for this error is when the iterator constructor of an `adjacency_list` is used. The workaround is to use `add_edge()` instead. Replace something like this:

    Graph g(edge_array, edge_array + n_edges, N);

with something like this:

    Graph g(N);
    for (std::size_t j = 0; j < n_edges; ++j)
      add_edge(edge_array[j].first, edge_array[j].second, g);

Copyright © 2000-2001 | Jeremy Siek, Indiana University (jsiek@osl.iu.edu) Lie-Quan Lee, Indiana University (llee@cs.indiana.edu) Andrew Lumsdaine, Indiana University (lums@osl.iu.edu)