Boost C++ Libraries: Ticket #5217: File streams broken on Windows with STLPort https://svn.boost.org/trac10/ticket/5217 <p> In filesystem/v3/fstream.hpp:26 there is an assumption that on Windows STL streams support wide-character file names as arguments. If STLPort is used this is not true. This breaks compilation on this platform with the following output: </p> <pre class="wiki">C:\_Sources\boost-release\boost/filesystem/v3/fstream.hpp(123) : error C2664: 'stlp_std::basic_ofstream&lt;_CharT,_Traits&gt;::open' : cannot convert parameter 1 from 'const boost::filesystem3::path::value_type *' to 'const char *' with [ _CharT=char, _Traits=stlp_std::char_traits&lt;char&gt; ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\_Sources\boost-release\boost/filesystem/v3/fstream.hpp(123) : while compiling class template member function 'void boost::filesystem3::basic_ofstream&lt;charT&gt;::open(const boost::filesystem3::path &amp;,stlp_std::ios_base::openmode)' with [ charT=char ] libs\log\src\text_file_backend.cpp(1078) : see reference to class template instantiation 'boost::filesystem3::basic_ofstream&lt;charT&gt;' being compiled with [ charT=char ] libs\log\src\text_file_backend.cpp(1440) : see reference to class template instantiation 'boost::log2_mt_nt6::sinks::basic_text_file_backend&lt;CharT&gt;::implementation' being compiled with [ CharT=char ] </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5217 Trac 1.4.3 Andrey Semashev Wed, 23 Feb 2011 14:02:01 GMT attachment set https://svn.boost.org/trac10/ticket/5217 https://svn.boost.org/trac10/ticket/5217 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">fstream.patch</span> </li> </ul> <p> The simple patch that fixes the problem </p> Ticket Beman Dawes Wed, 23 Feb 2011 15:52:32 GMT <link>https://svn.boost.org/trac10/ticket/5217#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5217#comment:1</guid> <description> <p> Does the following patch work? It is supposed to support all non-Dinkumware libraries. </p> <p> Thanks, </p> <p> --Beman </p> <p> --- c:\temp\fstream_HEAD.hpp 2011-02-23 10:44:34.000000000 -0500 +++ c:\boost\github\libs\filesystem\include\boost\filesystem\v3\fstream.hpp 2011-02-23 10:43:21.000000000 -0500 @@ -24,13 +24,13 @@ </p> <blockquote> <p> #include &lt;boost/config/abi_prefix.hpp&gt; <em> must be the last #include </em></p> </blockquote> <p> </p> <blockquote> <p> <em> on Windows, except for standard libaries known to have wchar_t overloads for </em> file stream I/O, use path::string() to get a narrow character c_str() #if defined(BOOST_WINDOWS_API) \ </p> </blockquote> <ul><li> &amp;&amp; !(defined(_CPPLIB_VER) &amp;&amp; _CPPLIB_VER &gt;= 405) <em> not (Dinkumware with overloads) </em></li></ul><table class="wiki"> <tr>+ &amp;&amp; (!defined(_CPPLIB_VER) <td> _CPPLIB_VER &lt; 405) <em> (!Dinkumware </em></td><td> no wide overloads) </td></tr></table> <blockquote> <p> # define BOOST_FILESYSTEM_C_STR string().c_str() <em> use narrow, since wide not available #else </em> use the native c_str, which will be narrow on POSIX, wide on Windows # define BOOST_FILESYSTEM_C_STR c_str() #endif </p> </blockquote> <p> </p> <blockquote> <p> namespace boost </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Wed, 23 Feb 2011 16:58:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5217#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5217#comment:2</guid> <description> <p> Never mind. I'm going with your patch. </p> <p> Thanks, </p> <p> --Beman </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Wed, 23 Feb 2011 20:23:21 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5217#comment:3 https://svn.boost.org/trac10/ticket/5217#comment:3 <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> Fixed by revision 69220 </p> Ticket