Boost C++ Libraries: Ticket #4642: Including some BGL header files and boost/range/irange.hpp causes compile errors due to the name conflict https://svn.boost.org/trac10/ticket/4642 <p> Some BGL headers like boost/graph/detail/adjacency_list.hpp include boost/pending/integer_range.hpp and use a class template boost::integer_range to represent a vertex/edge list. Since 1.44.0, however, Boost.Range supports a class template which has the same name and probably the same role in boost/range/irange.hpp; it didn't have integer_range and instead used boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;Integer&gt; &gt; in 1.43.0. Therefore the following simple code causes compile errors using 1.44.0. </p> <pre class="wiki">// test.cpp #include &lt;boost/graph/adjacency_list.hpp&gt; #include &lt;boost/range/irange.hpp&gt; int main() { return 0; } </pre><p> The errors are as follows; </p> <pre class="wiki">$ g++ --version g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ test.cpp -I/usr/local/include/boost_1_44_0 In file included from test.cpp:2: /usr/local/include/boost_1_44_0/boost/range/irange.hpp:176: error: redefinition of ‘class boost::integer_range&lt;IntegerType&gt;’ /usr/local/include/boost_1_44_0/boost/pending/integer_range.hpp:23: error: previous definition of ‘class boost::integer_range&lt;IntegerType&gt;’ $ g++ test.cpp -I/usr/local/include/boost_1_43_0 $ </pre><p> Note that /usr/local/include/boost_1_xx_x is the directory the boost 1.xx.x is installed. </p> <p> To fix this problem, I think it's OK just to replace the including file from boost/pending/integer_range.hpp to boost/range/irange.hpp in BGL. The header files which include boost/pending/integer_range.hpp are as follows; </p> <ul><li>boost/graph/adjacency_matrix.hpp </li><li>boost/graph/detail/adjacency_list.hpp </li><li>boost/graph/edge_list.hpp </li><li>boost/graph/vector_as_graph.hpp </li></ul><p> Note that I haven't checked whether this modification works completely well or not. I've just checked the above example code works after this modification. </p> <p> After this modification, I think boost/pending/integer_range.hpp can be removed from the boost library because no other files include this pending header file. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4642 Trac 1.4.3 Naoki Yoshioka <yoshioka.naoki@…> Fri, 10 Sep 2010 12:46:35 GMT attachment set https://svn.boost.org/trac10/ticket/4642 https://svn.boost.org/trac10/ticket/4642 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patchfile.patch</span> </li> </ul> <p> to replace the including file from pending one to that in Boost.Range </p> Ticket Andrew Sutton Sat, 11 Sep 2010 14:07:06 GMT <link>https://svn.boost.org/trac10/ticket/4642#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4642#comment:1</guid> <description> <p> Deprecated pending/integer_range (will be removed in a future release) and replaced all references in the BGL with range/irange.hpp. Changes in <a class="changeset" href="https://svn.boost.org/trac10/changeset/65385" title="Fixing #4642. Added a deprecation warning to to ...">r65385</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jeremiah Willcock</dc:creator> <pubDate>Sun, 05 Dec 2010 20:38:47 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4642#comment:2 https://svn.boost.org/trac10/ticket/4642#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/67035" title="Removed &lt;boost/pending/integer_range.hpp&gt; and a few more uses of it; ...">[67035]</a>) Removed &lt;boost/pending/integer_range.hpp&gt; and a few more uses of it; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4642" title="#4642: Bugs: Including some BGL header files and boost/range/irange.hpp causes ... (closed: fixed)">#4642</a> </p> Ticket