Boost logo

Boost :

From: David Daeschler (daveregs_at_[hidden])
Date: 2005-05-26 08:17:19


Hello Sir,

Thank you for your reply. It looks like the tests all pass if I run them by
using bjam and building them in their respective directories. However, if I
compile the minimal.cpp file outside of the boost build environment (move
the file somewhere else and build using make) the test fails.

I think I may be missing required compiler defines when I compile my test
program, but I can't figure out what these may be.

As an example, I wrote a simple test program that currently fails under my
configuration.

bfs.cpp --

#include <boost/filesystem/path.hpp>
#include <boost/filesystem/exception.hpp>
namespace fs = boost::filesystem;

#include <iostream>

int main(int argc, char* argv[])
{
  try {
    fs::path p("c:\\3Com", fs::native);
  }
  catch (std::exception& e) {
    std::cout << e.what() << std::endl;
  }

  return 0;
}

Makefile --

CXX = g++
PROGRAM = bfs
OBJECTS = $(PROGRAM).o
INCDIRS = -I$(BOOSTROOT)
CFLAGS =
LIBDIRS = -L$(BOOSTROOT)/stage/lib
LIBS = -lboost_filesystem-mgw-d-1_32

.SUFFIXES: .o .cpp

.cpp.o :
 $(CXX) $(CFLAGS) $(INCDIRS) -c -o $@ $<

all: $(PROGRAM)

$(PROGRAM): $(OBJECTS)
 $(CXX) $(LIBDIRS) -o $(PROGRAM) $(OBJECTS) $(LIBS)

clean:
 rm -f *.o *.exe

The output of the program is - boost::filesystem::path: invalid name
"c:\3Com" in path: "c:\3Com"
"c:\3Com" is a valid directory on this machine.

Thank you for your time,
- Dave

"Beman Dawes" <bdawes_at_[hidden]> wrote in message
news:d73bic$1jj$1_at_sea.gmane.org...
>
> "David Daeschler" <daveregs_at_[hidden]> wrote in message
> news:d72il3$ukb$1_at_sea.gmane.org...
>> Hello,
>>
>>>From my application there may come a time when I want to take a directory
>>>or
>> file name from a user. In windows, there is a file selection box that
>> can
>> return the full path of a file that the user chooses. The full path in
>> windows includes the drive name with a colon and then a backslash (
>> c:\ ).
>> I can not seem to get the boost filesystem library to accept this as a
>> valid
>> path even with the native checker. I also ran the test provided with
>> boost
>> for paths and it failed. The output is given below.
>>
>> $ bfs
>> Platform is Windows
>> initial_path().string() is
>> "g:/boostfs"
>> initial_path().native_file_string() is
>> "g:\boostfs"
>> d:/srcbuilds/boost_1_32_0/boost/test/minimal.hpp(129): exception
>> "std::exception
>> : boost::filesystem::path: invalid name "c:" in path: "c:/"" caught in
>> function:
>> 'int main(int, char**)'
>>
>> **** Testing aborted.
>> **** 1 error detected
>>
>> It appears that the colon is in the list of invalid characters for a file
>> and it is throwing things off.
>>
>> My version of Boost was compiled with MinGW under Windows XP SP2 using
>> the
>> command line bjam "-sTOOLS=mingw" stage
>>
>> If I am missing something please let me know.
>
> I don't know what the problem is. Two different regression testers test
> mingw, and filesystem passes for both on all tests.
>
> If you haven't figured out what is wrong by tomorrow, let me know and I'll
> try to reproduce the problem. (The machine I'm writing this on isn't set
> up for development, so I can't test it right now.)
>
> --Beman
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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