Boost logo

Boost Users :

Subject: [Boost-users] Compiling probs with Filesystem in 1.38.0
From: Loreene Dixon (ldixon.dev_at_[hidden])
Date: 2009-03-11 19:07:00

 I successfully used Boost 1.33.1 with VS 2005.

Now I have the task of upgrading our software to VS 2008 ASAP and in so
doing, I upgraded our Boost to 1.38.0.

Apparently, Boost's Filesystem got revamped in 1.34.0 and the contents of
exception.hpp got moved to path.hpp and into Interprocess (!) library's
errors.hpp. We cannot call the error() routine anymore as it's no longer a
member of filesystem_error.

Here is an extract of our code (for Boost 1.33.1):

#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/operations.hpp>
  createViToolkitException(boost::filesystem::filesystem_error& e)
     switch (e.error()) {
     case boost::filesystem::other_error:
     case boost::filesystem::path_error:
     case boost::filesystem::not_found_error:
     case boost::filesystem::not_directory_error:
     case boost::filesystem::already_exists_error:
        throw vit::BadPathException(e.what());

        throw vit::GeneralException(e.what());

  boost::filesystem::path createPath(const std::wstring& pathName)
     try {
        return boost::filesystem::path(vit::wideStringToString(pathName),
     catch (boost::filesystem::filesystem_error& e) {
         throw createViToolkitException(e);

So basically we call Boost's methods and if an error occurs, we catch it and
throw createViToolkitException where it examines the error to determine
whether it's a bad path or general exception and throws a new appropriate

When I attempted to compile Boost 1.38.0, my compiler errors were: : error C2039: 'error' : is not a member of
] : error C2039: 'other_error' : is not a member of
'boost::filesystem' : error C2065: 'other_error' : undeclared identifier : error C2051: case expression not constant : error C2039: 'path_error' : is not a member of
'boost::filesystem' : error C2065: 'path_error' : undeclared identifier

I changed the #include <boost/filesystem/exception.hpp> to #include

I could change all 'boost::filesystem::filesystem_error' references to

What can I do about the ' switch (e.error()) {' call since the error() call
is no longer available? Is there a different method that I should call?

And do I replace 'boost::filesystem::path_error' with

What do I need to do in order to recompile in Boost 1.38.0 and still have
the same functionality? I inherited this code from our east coast developers
and am somewhat a Boost newbie.


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