| 1 | <HTML> |
|---|
| 2 | <!-- |
|---|
| 3 | -- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000 |
|---|
| 4 | -- |
|---|
| 5 | -- Distributed under the Boost Software License, Version 1.0. |
|---|
| 6 | -- (See accompanying file LICENSE_1_0.txt or copy at |
|---|
| 7 | -- http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 8 | --> |
|---|
| 9 | <Head> |
|---|
| 10 | <Title>Boost Graph Library: Trouble Shooting</Title> |
|---|
| 11 | <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" |
|---|
| 12 | ALINK="#ff0000"> |
|---|
| 13 | <IMG SRC="../../../boost.png" |
|---|
| 14 | ALT="C++ Boost" width="277" height="86"> |
|---|
| 15 | |
|---|
| 16 | <BR Clear> |
|---|
| 17 | |
|---|
| 18 | <h1>Trouble Shooting</h1> |
|---|
| 19 | |
|---|
| 20 | <hr> |
|---|
| 21 | |
|---|
| 22 | With GNU C++, if you see the following error message: |
|---|
| 23 | <pre> |
|---|
| 24 | boost/type_traits/arithmetic_traits.hpp:243: template instantiation depth exceeds maximum of 17 |
|---|
| 25 | boost/type_traits/arithmetic_traits.hpp:243: (use -ftemplate-depth-NN to increase the maximum) |
|---|
| 26 | </pre> |
|---|
| 27 | then you need to do as the error message advises and increase the |
|---|
| 28 | template instantiation depth. Passing the flag |
|---|
| 29 | <tt>-ftemplate-depth-30</tt> to g++ usually does the trick. |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | <hr> |
|---|
| 33 | <pre> |
|---|
| 34 | error C2784: 'T __cdecl source(struct std::pair<T,T>,const G &)' : |
|---|
| 35 | could not deduce template argument for 'struct std::pair<_T1,_T1>' from |
|---|
| 36 | 'class boost::detail::bidir_edge<struct boost::bidirectional_tag,unsigned int>' |
|---|
| 37 | </pre> |
|---|
| 38 | |
|---|
| 39 | <p> |
|---|
| 40 | VC++ does not support Koenig Lookup, therefore you need to refer to functions defined in the boost namespace |
|---|
| 41 | using the <tt>boost::</tt> prefix, i.e., <tt>boost::source(e, g)</tt> instead of <tt>source(e, g)</tt>. |
|---|
| 42 | |
|---|
| 43 | <hr> |
|---|
| 44 | <pre> |
|---|
| 45 | ../../..\boost/property_map.hpp(283) : error C2678: binary '[' : no operator defined |
|---|
| 46 | which takes a left-hand operand of type 'const struct boost::adj_list_edge_property_map<struct |
|---|
| 47 | boost::bidirectional_tag,struct boost::property<enum boost::edge_weight_t,int,struct |
|---|
| 48 | boost::no_property>,unsigned int,enum boost::edge_weight_t>' (or there is no acceptable conversion) |
|---|
| 49 | </pre> |
|---|
| 50 | |
|---|
| 51 | <p>There is a VC++ bug that appears when using <tt>get(property, |
|---|
| 52 | graph, edge)</tt>. A workaround is to use <tt>get(get(property, |
|---|
| 53 | graph), edge)</tt> instead. |
|---|
| 54 | |
|---|
| 55 | <hr> |
|---|
| 56 | |
|---|
| 57 | <pre> |
|---|
| 58 | C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(59) : fatal |
|---|
| 59 | error C1001: INTERNAL COMPILER ERROR |
|---|
| 60 | (compiler file 'msc1.cpp', line 1786) |
|---|
| 61 | </pre> |
|---|
| 62 | |
|---|
| 63 | <p>There can be many reasons for this error, but sometimes it is |
|---|
| 64 | caused by using the flag <tt>/Gm</tt> (minimal rebuild). As this flag |
|---|
| 65 | is not really necessary, it is a good idea to turn it off. |
|---|
| 66 | |
|---|
| 67 | <p> |
|---|
| 68 | Another reason for the error can be the use of the named-parameter |
|---|
| 69 | interface for many of the BGL algorithms. Try using the non |
|---|
| 70 | named-parameter version of the algorithm instead (see the HTML docs |
|---|
| 71 | for the algorithm in question). |
|---|
| 72 | |
|---|
| 73 | <p> |
|---|
| 74 | Yet another reason can be the use of the <tt>get()</tt> function of |
|---|
| 75 | the <a href"PropertyGraph.html">PropertyGraph</a> interface. Instead |
|---|
| 76 | of using the <tt>get()</tt> function in a complex expression, always |
|---|
| 77 | declare a property map variable first: |
|---|
| 78 | <pre> |
|---|
| 79 | property_map<graph_t, edge_weight_t>::type w_map = get(edge_weight, g); |
|---|
| 80 | // use w_map ... |
|---|
| 81 | </pre> |
|---|
| 82 | |
|---|
| 83 | <hr> |
|---|
| 84 | |
|---|
| 85 | <pre> |
|---|
| 86 | V:\3rdPARTY\SXL\INCLUDE\xlocnum(309) : error C2587: '_U' : illegal |
|---|
| 87 | use of local variable as default parameter |
|---|
| 88 | </pre> |
|---|
| 89 | <p> |
|---|
| 90 | Workaround from Andreas Scherer:<br> |
|---|
| 91 | That's the usual problem with MSVC-- 6.0 sp[34] when compiling some |
|---|
| 92 | (or all?) of the BGL examples. You can't use the DLL version of the |
|---|
| 93 | run-time system. I succeeded in compiling file_dependencies.cpp after |
|---|
| 94 | switching to ``[Debug] Multithreaded'' (section ``Code Generation'' on |
|---|
| 95 | page ``C/C++'' in the ``Project Settings''). |
|---|
| 96 | |
|---|
| 97 | <p> |
|---|
| 98 | Another reason for this error is when the iterator constructor of an |
|---|
| 99 | <tt>adjacency_list</tt> is used. The workaround is to use |
|---|
| 100 | <tt>add_edge()</tt> instead. Replace something like this: |
|---|
| 101 | <pre> |
|---|
| 102 | Graph g(edge_array, edge_array + n_edges, N); |
|---|
| 103 | </pre> |
|---|
| 104 | with something like this: |
|---|
| 105 | <pre> |
|---|
| 106 | Graph g(N); |
|---|
| 107 | for (std::size_t j = 0; j < n_edges; ++j) |
|---|
| 108 | add_edge(edge_array[j].first, edge_array[j].second, g); |
|---|
| 109 | </pre> |
|---|
| 110 | |
|---|
| 111 | <hr> |
|---|
| 112 | |
|---|
| 113 | <br> |
|---|
| 114 | <HR> |
|---|
| 115 | <TABLE> |
|---|
| 116 | <TR valign=top> |
|---|
| 117 | <TD nowrap>Copyright © 2000-2001</TD><TD> |
|---|
| 118 | <A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>, |
|---|
| 119 | Indiana University (<A |
|---|
| 120 | HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br> |
|---|
| 121 | <A HREF="../../../people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@cs.indiana.edu">llee@cs.indiana.edu</A>)<br> |
|---|
| 122 | <A HREF=http://www.osl.iu.edu/~lums>Andrew Lumsdaine</A>, |
|---|
| 123 | Indiana University (<A |
|---|
| 124 | HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>) |
|---|
| 125 | </TD></TR></TABLE> |
|---|
| 126 | |
|---|
| 127 | </BODY> |
|---|
| 128 | </HTML> |
|---|