Boost C++ Libraries: Ticket #4891: include config/user.hpp in filesystem/* headers https://svn.boost.org/trac10/ticket/4891 <p> It would be convenient to be able to define default Boost.Filesystem version by defining BOOST_FILESYSTEM_VERSION macro in the boost/config/user.hpp header. In order that to work, dispatching headers in boost/filesystem should include boost/config/user.hpp (or boost/config.hpp) before testing the macro and deciding which library version to use. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4891 Trac 1.4.3 Beman Dawes Sat, 04 Dec 2010 12:54:33 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4891#comment:1 https://svn.boost.org/trac10/ticket/4891#comment:1 <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> All Boost.Filesystem headers already first include &lt;boost/config.hpp&gt; directly or indirectly. That isn't obvious, particularly for V2, so I added some initial V2 includes to make it more obvious. </p> <p> The documentation has also been changed to add &lt;boost/config/user.hpp&gt; to the list of places where BOOST_FILESYSTEM_VERSION can be defined. </p> <p> Thanks, </p> <p> --Beman </p> Ticket Andrey Semashev Sun, 05 Dec 2010 10:54:13 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/4891#comment:2 https://svn.boost.org/trac10/ticket/4891#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> No, it doesn't work, because headers directly beneath filesystem directory don't include config.hpp. Assuming I have #defined BOOST_FILESYSTEM_VERSION 2 in my user.hpp, compiling this code fails: </p> <pre class="wiki">#include &lt;boost/filesystem/path.hpp&gt; template&lt; typename T1, typename T2 &gt; void with_path(boost::filesystem::basic_path&lt; T1, T2 &gt;) { } int main(int, char*[]) { with_path(boost::filesystem::path()); return 0; } </pre><p> The error is as follows: </p> <pre class="wiki">In file included from ./boost/config.hpp:26, from ./boost/filesystem/v3/path.hpp:18, from ./boost/filesystem/path.hpp:28, from fs_test.cpp:1: ./boost/config/user.hpp:123: warning: "BOOST_FILESYSTEM_VERSION" redefined ./boost/filesystem/path.hpp:21: note: this is the location of the previous definition In file included from ./boost/filesystem/v3/path.hpp:24, from ./boost/filesystem/path.hpp:28, from fs_test.cpp:1: ./boost/filesystem/v3/config.hpp:16: error: #error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3 fs_test.cpp:4: error: variable or field ‘with_path’ declared void fs_test.cpp:4: error: ‘basic_path’ is not a member of ‘boost::filesystem’ fs_test.cpp:4: error: expected primary-expression before ‘,’ token fs_test.cpp:4: error: expected primary-expression before ‘&gt;’ token fs_test.cpp:4: error: expected primary-expression before ‘)’ token fs_test.cpp: In function ‘int main(int, char**)’: fs_test.cpp:11: error: ‘with_path’ was not declared in this scope </pre> Ticket Beman Dawes Mon, 06 Dec 2010 13:17:48 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4891#comment:3 https://svn.boost.org/trac10/ticket/4891#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</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/67066" title="Fix #4891, again, clearing problem if BOOST_FILESYSTEM_VERSION defined ...">[67066]</a>) Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4891" title="#4891: Feature Requests: include config/user.hpp in filesystem/* headers (closed: fixed)">#4891</a>, again, clearing problem if BOOST_FILESYSTEM_VERSION defined in &lt;boost/config/user.hpp&gt; </p> Ticket anonymous Fri, 20 Jul 2012 08:39:07 GMT attachment set https://svn.boost.org/trac10/ticket/4891 https://svn.boost.org/trac10/ticket/4891 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">config.hpp</span> </li> </ul> Ticket