Boost logo

Boost :

From: Wieger Wesselink (wieger_at_[hidden])
Date: 2006-06-12 08:05:26


Hi,

I am trying to run the program fragment below (extracted from process_jam_log.cpp) that creates a file in a new directory using the filesystem library on cygwin. It fails to create the directory and the file without printing a warning. Note that I'm using native cygwin paths. When I change the path into 'd:/newdir/newfile' everything works as expected.

When I define the macro BOOST_POSIX_API it doesn't even compile due to an undefined function status_api. Is this a bug in the library or am I missing something obvious?

Best regards,

Wieger

#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/fstream.hpp"
#include "boost/filesystem/exception.hpp"
#include "boost/filesystem/convenience.hpp"

#include <iostream>
#include <string>

namespace fs = boost::filesystem;

int main()
{
  fs::path pth( "/cygdrive/d/newdir/newfile" );
  if ( !fs::exists( pth.branch_path() ) )
  {
    fs::create_directories( pth.branch_path() );
  }
  fs::ofstream file( pth );
  if ( !file )
  {
    std::cout << "*****Warning - can't open output file: "
      << pth.string() << "\n";
  }
  return 0;
}

error message when BOOST_POSIX_API is defined:

gcc.link bin/gcc/release/link-static/test.exe
bin/gcc/release/link-static/test.o:test.cpp:(.text+0x4a1): undefined reference to `boost::filesystem::detail::status_api(std::basic_string<char, std::har_trait
s<char>, std::allocator<char> > const&, int&)'

-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com
Powered by Outblaze

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