problem using boost::filesystem

Hello... I am triing to use the boost::filesystem library. But actually i am stucked using it. I have WindowsXP without a service pack. I am using Visual Studio 6.0 installed in default folders for VS6. I am using stlport but without the iostreams. After uncompressing boost, i compiled boost with bjam with following statement: bjam "-sTOOLS=msvc-stlport" "-sSTLPORT_VERSION=4.6" "-sSTLPORT_PATH=..\stlport" "-sBUILD=debug <stlport-iostream>off" stage Compilation has no errors and all libs are build. Now i want to use boost::filesystem::path, example: #include <boost/filesystem/path.hpp> int main(int argc, char* argv[]) { boost::filesystem::path( "foo" ); } What happens, is that the program stops on that command and does nothing! If i use following code: boost::filesystem::path( "C:\\" ); System makes an kernal32 exception and crashs. Same happens when i use boost::filesystem::exists Could you please help me why that happens??? Thx Mesut

Try boost::filesystem::path(C:\\, boost::filesystem::native); You can also take a look at the examples under <boost/libs/filesystem/example> Hope this helps, -delfin _____ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Mesut Büyüktokatli Sent: Sunday, July 24, 2005 7:19 AM To: boost-users@lists.boost.org Subject: [Boost-users] problem using boost::filesystem Hello... I am triing to use the boost::filesystem library. But actually i am stucked using it. I have WindowsXP without a service pack. I am using Visual Studio 6.0 installed in default folders for VS6. I am using stlport but without the iostreams. After uncompressing boost, i compiled boost with bjam with following statement: bjam "-sTOOLS=msvc-stlport" "-sSTLPORT_VERSION=4.6" "-sSTLPORT_PATH=..\stlport" "-sBUILD=debug <stlport-iostream>off" stage Compilation has no errors and all libs are build. Now i want to use boost::filesystem::path, example: If i use following code: boost::filesystem::path( "C:\\" ); System makes an kernal32 exception and crashs.

Well, when i try boost::filesystem::path("C:\\", boost::filesystem::native); i get a linker error saying this: Tutorial02.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall boost::filesystem::path::path(char const *,bool (__cdecl*)(class _STL::basic_string<char,struct std::char_traits<char>,class _STL::allocator<char> > const &))" (?? 0path@filesystem@boost@@QAE@PBDP6A_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@_STL@@@_STL@@@Z@Z) Tutorial02.obj : error LNK2001: Nichtaufgeloestes externes Symbol "bool __cdecl boost::filesystem::native(class _STL::basic_string<char,struct std::char_traits<char>,class _STL::allocator<char> > const &)" (?native@filesystem@boost@@YA_NABV?$basic_s tring@DU?$char_traits@D@std@@V?$allocator@D@_STL@@@_STL@@@Z) Debug/Tutorial02.exe : fatal error LNK1120: 2 unaufgeloeste externe Verweise (Sorry its german writings in it) Mesut ----- Original Message ----- From: Delfin Rojas To: boost-users@lists.boost.org Sent: Monday, July 25, 2005 9:03 PM Subject: Re: [Boost-users] problem using boost::filesystem Try boost::filesystem::path("C:\\", boost::filesystem::native); You can also take a look at the examples under <boost/libs/filesystem/example> Hope this helps, -delfin

Mmm, not sure what is going on there. I can only recommend to take a look at the examples the library provides. Also try linking against the static filesystem lib. -delfin _____ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Mesut Büyüktokatli Sent: Monday, July 25, 2005 2:29 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] problem using boost::filesystem Well, when i try boost::filesystem::path(C:\\, boost::filesystem::native); i get a linker error saying this: Tutorial02.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall boost::filesystem::path::path(char const *,bool (__cdecl*)(class _STL::basic_string<char,struct std::char_traits<char>,class _STL::allocator<char> > const &))" (?? 0path@filesystem@boost@@QAE@PBDP6A_NABV?$basic_string@DU?$char_traits@D@std@ @V?$allocator@D@_STL@@@_STL@@@Z@Z) Tutorial02.obj : error LNK2001: Nichtaufgeloestes externes Symbol "bool __cdecl boost::filesystem::native(class _STL::basic_string<char,struct std::char_traits<char>,class _STL::allocator<char> > const &)" (?native@filesystem@boost@@YA_NABV?$basic_s tring@DU?$char_traits@D@std@@V?$allocator@D@_STL@@@_STL@@@Z) Debug/Tutorial02.exe : fatal error LNK1120: 2 unaufgeloeste externe Verweise (Sorry its german writings in it) Mesut

I'm fiddling with the same stuff at the moment. The problem you're having is that the way you compiled the boost::filesystem library is not compatible with the stlport library (just check and you'll see that the mangled names of the functions the linker needs contain the substring _STL, whereas the corresponding mangled names in the library you're linking with have the substring std in the same place instead). What you could do is add the switch -d+2 to the bjam command line when you build the library. It will show you the stlport library switches used. I ended up copying the stuff that bjam printed to the terminal and pasted it into a text editor. Then I changed all the switches that I didn't think were right and saved the file as a batch file which I then executed to build the library (yikes!). But as far as I can tell there is no way to build boost "out of the box" with bjam using VC++ 6.0 and stlport. Anyway, with the exception of the filesystem::path::iterator all is working ok using this approach. Pete -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Mesut Büyüktokatli Sent: Tuesday, 26 July 2005 9:29 a.m. To: boost-users@lists.boost.org Subject: Re: [Boost-users] problem using boost::filesystem Well, when i try boost::filesystem::path(C:\\, boost::filesystem::native); i get a linker error saying this: Tutorial02.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall boost::filesystem::path::path(char const *,bool (__cdecl*)(class _STL::basic_string<char,struct std::char_traits<char>,class _STL::allocator<char> > const &))" (?? 0path@filesystem@boost@@QAE@PBDP6A_NABV?$basic_string@DU?$char_traits@D@ std@@V?$allocator@D@_STL@@@_STL@@@Z@Z) Tutorial02.obj : error LNK2001: Nichtaufgeloestes externes Symbol "bool __cdecl boost::filesystem::native(class _STL::basic_string<char,struct std::char_traits<char>,class _STL::allocator<char> > const &)" (?native@filesystem@boost@@YA_NABV?$basic_s tring@DU?$char_traits@D@std@@V?$allocator@D@_STL@@@_STL@@@Z) Debug/Tutorial02.exe : fatal error LNK1120: 2 unaufgeloeste externe Verweise (Sorry its german writings in it) Mesut ----- Original Message ----- From: Delfin <mailto:drojas@moodlogic.com> Rojas To: boost-users@lists.boost.org Sent: Monday, July 25, 2005 9:03 PM Subject: Re: [Boost-users] problem using boost::filesystem Try boost::filesystem::path(C:\\, boost::filesystem::native); You can also take a look at the examples under <boost/libs/filesystem/example> Hope this helps, -delfin
participants (3)
-
Delfin Rojas
-
Mesut Büyüktokatli
-
Pete