
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 ,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<