Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-08-25 16:11:41


Joshua Peterson wrote:
>> It seems that Boost.FileSystem does not implement some methods accepting
>>> wpath arguments when compiled with GCC 3.4.3 on Linux. This occurs
>>> because
>>> BOOST_FILESYSTEM_NARROW_ONLY is defined, which according to the comment in
>>> the code occurs for "badly broken compilers or libraries".
>>>
>> Something is amiss. IIRC, BOOST_FILESYSTEM_NARROW_ONLY should only be
>> defined for GCC on Windows/Cygwin, which doesn't have wide character
>> support. Don't all modern versions of GCC on Linux support wide characters?
>>
>> Could you please check to see if BOOST_FILESYSTEM_NARROW_ONLY really is
>> being defined?
>>
>>
> Well, after a bit more investigation, it seems that the
> boost::filesystem::detail::copy_file_api(const std::wstring & from, const
> std::wstring & to) is not only behind BOOST_FILESYSTEM_NARROW_ONLY, but is
> also behind BOOST_WINDOWS_API, so it is explicitly only available on
> Windows.

That's normal. Windows has both wide and narrow API's but POSIX has only
a narrow char API.

>
> So I was incorrect, BOOST_FILESYSTEM_NARROW_ONLY is not defined for GCC
> 3.4.3, as I do get the wide character path manipulation methods. However,
> it is that Windows API define that prevents the above copy_file_api
> definition from being used.

Let's get back to basics. Does this program compile for you?

   #include <boost/filesystem/operations.hpp>

   int main()
   {
     boost::filesystem::copy_file( L"foo", L"bar" );
     return 0;
   }

In compiles fine for me on Ubuntu 8.04.1 and g++ 4.2.1. I haven't had a
chance yet to build the libraries to see if it links. I'll do that later
tonight or tomorrow.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk