Hi Donald :
I had exactly the same problems no matter what the path combinations.
If I included the path code directly in my app/dll it worked great,
but always failed externally. The problem was multiple dlls including
different builds of boost, ie static or dynamic.
Try the following (I'm assuming a debug build) :
1. Define BOOST_ALL_DYN_LINK in _every_ module that will link against
your module containing the boost path usage. This is key.
2. In VC, go to properties-->linker-->Input and remove any explicit
boost references (ie libboost_filesystem-vc71-mt-gd.lib).
3. Now, just to be sure, make yourself a "special" boost library
folder containing only boost_filesystem-vc71-mt-gd-1_32.lib.
Something like c:\temp\boost.
4. In VC, go back to properties-->linker-->General and add the
"special" folder as the only location where the linker can pick up the
boost libraries. This is to ensure that the linker only finds the
single boost instance we want it to find.
5. This is probably obvious, but make sure that you're compiling with
the same rtl as boost (in my example here, /MDd). Look in
properties-->C/C++-->Code Generation.
6. Do a clean build and see what happens.
If the linker complains about missing boost libraries (ie can't find
libboost etc etc) then double check that you have /DBOOST_ALL_DYN_LINK
and that the rtl is consistent.
Let me know if that works and good luck;
Steve a.
On 4/26/05, Johnson, Donald W MVK Contractor
Boost::filesystem::path is failing to create any paths. If always throws and exception stating invalid path. In the main function I call
boost::filesystem::path::default_name_check( boost::filesystem::native ); boost::filesystem::initial_path();
The attempts to construct paths are in the pattern
boost::filesystem::path(some_path_name);
Specificly the error occurs here in constructing a path
void path::m_path_append( const std::string & src, name_check checker ) { // convert backslash to forward slash if checker==native // allow system-specific-root if checker==no_check || checker==native
assert( checker ); assert( src.size() == std::strlen( src.c_str() ) ); // no embedded 0
if ( src.size() == 0 ) return;
std::string::const_iterator itr( src.begin() );
// [root-filesystem] # ifdef BOOST_WINDOWS if ( (checker == no_check || checker == native) && src.size() >= 2 ) // This fails { ...
Since fore some reasion it seemed to be failing to get the native checker I tired this instead
boost::filesystem::path(some_path_name,boost::filesystem::native);
But the above test still fails.
This seems to be related to the filesystem code being used in the main application and a DLL.
I added this line to boost/config/user.hpp
#define BOOST_FILESYSTEM_DYN_LINK
So the library should be dynamicly linked and it being used in two places shouldn't be a problem. If I trace the function in a debugger all calls to the filesystem library look like this
> FESMLibDebug.dll!boost::filesystem::path::default_name_check(bool (const std::basic_string
&)* new_check=0x004573e2) > FESMLibDebug.dll!boost::filesystem::path::m_path_append(const std::basic_string
& src={...}, bool (const std::basic_string &)* checker=0x004573e2) So it doesn't look like im getting 2 copies of boostfile system. I previously was getting calls to $(APPNAME)!boost::filesystems and $(DLLNAME)!boost::filesystems.
However, if I incluede the source files of the dll directly into the application the problem dissapears. Anyone know what I missed? This is with Visual C++ 2003 and Windows XP.
Thanks Donald Johnson
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users