Program runs under debugger, fails using command line

I have written a command line program that, up until recently, had been built and tested using a 64-bit compiler. With a 64-bit build, this program runs great, everything works as expected. Strangely enough, when I recently switched to building for the 32-bit architecture on a different computer, a strange bug appeared. Launching the program with a certain flag under the command prompt with the program will cause the program to terminate early with no warning, no signs of what's going on at all, nothing. The program displays part of its output, then drops back to the command prompt.

The really weird thing is that if I run the program using the Visual Studio and the appropriate flags, it runs exactly as it's supposed to. (With and without the debugger; release and debug builds.) I've even tried a different compiler. Building inside of Visual Studio with the Intel C++ Compiler produces the same results.

The tricky thing here is that I can't use the debugger. The weird behavior is only seen outside of the debugger.

What exactly might be causing this? I've gone over my code a number of times, and it doesn't seem that there's anything that could be causing it. There are no glaring errors from what I can see.
Last edited on
Sounds like you've come across the much feared Heisenbug.
Try running the program through a memory debugger. If you can compile for Linux, Valgrind is great. If there are no memory bugs, all that's left to do is perform a debug session through squishyware.
Topic archived. No new replies allowed.