Boost logo

Boost Users :

Subject: [Boost-users] [filesystem] Using filesystem library from Boost version 1.44 on Cygwin 1.7
From: Clarke, Carus V (carus.v.clarke_at_[hidden])
Date: 2010-08-27 17:14:03

I have been using the filesystem library from Boost version 1.43 on a Cygwin 1.7.6-1 platform without any problems. The library was built using the Cygwin version of GCC 4.3.4. The library from the 1.44 version of Boost compiles compiles o.k., but the functions that access files no longer work. This appears to be true for both versions 2 and 3 of the library. Below is a simple program that runs o.k. with the Boost version 1.43 version of the library. The program runs but can not read the file status using Boost version 1.44. This program also works fine when built using MSVC 9.0 and Boost version 1.44.

Am I doing something wrong? Any help would be appreciated.


Carus V. (Bud) Clarke


#include <fstream>
#include <iostream>
#include <string>

#include <boost/version.hpp>


// disabled: # define BOOST_FILESYSTEM_VERSION 2
# endif

#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>

int main()
   namespace boost_fs = boost::filesystem;
   const std::string pathStr = "foo";
   std::ofstream ostrm(pathStr.c_str());
   if (ostrm)
      ostrm << "abcde-12345" << std::endl;
   boost_fs::path path(pathStr);
   boost::system::error_code ec;
   std::cout << std::boolalpha;
   std::cout << "Checking status of file " << pathStr << "..." << std::endl;
   boost_fs::file_status st = boost_fs::status(path, ec);
   std::cout << "Error code value: " << ec.value() << std::endl;
   std::cout << "Error code message: " << ec.message() << std::endl;
   return 0;


This program's output on my system is shown below. The file 'foo' is written by the program and does actually exist.

For version 2:

        boost::filesystem library version is v2
        Checking status of file foo...
        Error code value: 0
        Error code message: The operation completed successfully
        Does file exist? false

For version 3:

        boost::filesystem library version is v3
        Checking status of file foo...
        Error code value: 2
        Error code message: The system cannot find the file specified
        Does file exist? false


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at