C++: Compatibility workrounds for Boost.Filesystem 1.46 and earlier

Testing: Should compile and link with Boost 1.46.  Travis and the CI builds should all be green, but since they all use later Boost versions, they won't pick up on any problem here.

With the last commits, should compile on a minimum of Boost 1.42.  Tested on Debian oldstable.