My C++ program compiles successfully in Dev-C++, but it crashes when I run it. The code includes . Reinstalling Dev-C++ makes it work once, but after the first run the same problem comes back. What could be causing this, and how can I troubleshoot it?
2 Answers
Since you’re required to use Dev-C++, don’t switch tools just yet. Make a tiny test program containing only an include for iostream, int main(), and a simple output statement. If that runs repeatedly, the IDE is probably fine and the crash is in the larger program. If even the tiny program fails, verify that the compiler configuration and output folder are valid, then share the complete code and the exact error or crash behavior.
Reinstalling the IDE probably isn’t fixing the real issue. Including by itself won’t make a program crash; the problem is more likely in the code or in how the program is being run. Try running it from a terminal so you can see any error message, and check for common issues such as using an uninitialized pointer, accessing an array out of bounds, dividing by zero, or returning from main incorrectly. The exact code and crash message would be needed to identify the cause.
I only know that reinstalling works for the first run, then it stops working again. I’ll try running it from a terminal and check for an error message.

Our teacher requires Dev-C++, so I’ll test it with a minimal program before changing anything else.