
Trying to port a mac program onto windows. I've been having some trouble getting the boost portion of it to work. It appears to run fine in release mode*, but crashes when debugged. Below is an excised piece of code that seems to replicate the problem, and works perfectly in release mode but crashes when debugging. I'm using Code::Blocks under XP, with Boost 1.37 with Mingw 3.4.5 (linking to boost_system-mgw34-mt-1_37.lib and boost_filesystem-mgw34-mt-1_37.lib ) (Also: It doesn't crash when I run it in windows 95 compatibility mode, but that's not really an option because that completely breaks the program it's meant to be a part of). Code: #include "boost/filesystem/operations.hpp" #include "boost/filesystem/path.hpp" #include "boost/progress.hpp" #include <iostream> namespace fs = boost::filesystem; int main( int argc, char* argv[] ) { fs::path p("chapters"); fs::directory_iterator dir_iter(p), dir_end; std::cout<<"got here"; return 0; } Outputs "got here" in release, just crashes in debug, with backtrace: (gdb) backtrace #0 0x7c90120f in ntdll!DbgUiConnectToDbg () from C:\WINDOWS\system32\ntdll.dll #1 0x7c96c201 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll #2 0x0022f724 in ?? () #3 0x7c96c63e in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll #4 0x00448270 in __gnu_cxx::__mt_alloc<wchar_t>::_S_binmap () #5 0x003e0000 in ?? () #6 0x00448278 in __gnu_cxx::__pool_alloc<wchar_t>::_S_force_new () #7 0x0022f798 in ?? () #8 0x7c96d826 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll #9 0x003e0000 in ?? () #10 0x00448270 in __gnu_cxx::__mt_alloc<wchar_t>::_S_binmap () #11 0x7c96d9dc in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll #12 0x003e0000 in ?? () #13 0x00448278 in __gnu_cxx::__pool_alloc<wchar_t>::_S_force_new () #14 0x40000060 in ?? () #15 0x7c96d994 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll #16 0x003e0000 in ?? () #17 0x003e4418 in ?? () #18 0x40000060 in ?? () #19 0x003e0000 in ?? () #20 0x003e4418 in ?? () #21 0x00000000 in ?? () -------------------- Doing a similar build in Visual C++ 2008 with msvc builds of the library, I get the error Unhandled exception at 0x7c812aeb in filesystest.exe: Microsoft C++ exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char,std::char_traits<char>,std::allocator<char>
,boost::filesystem::path_traits> > at memory location 0x0012fb34..
whether I run a debug build or not. -------------------- Compiling with the debug builds of the libraries (X-mgw34-mt-d-1_37.lib) didn't produce significantly-different looking other errors from the ones above. Someone on the internet ( http://forums.codeblocks.org/index.php/topic,8429.msg64317.html#msg64317 ) seemed to have a similar problem, but his solution isn't satisfactory for me (for the reason given below). Linking to single-threaded builds of boost didn't seem to make a difference either. Any help with this would be really appreciated. Stephen *I say 'appears to run fine' because, in the program that I'm trying to port, in windows all I see is a blank window (it's an SDL application); I can std<<cout directory structures from it though. This is most likely an unrelated problem, but I can't start to debug that until I've gotten this problem out of the way.