Running program in IDE (Dev-C++)

Hello,

I'm writing a small game to test some SDL features. When I run this program in my IDE (Dev-C++ 4.9.9.2) by clicking on 'run' there are some strange bugs from wich I can't find the causes in the code, and that result in shutting down the program when it shouldn't. But when I run the program using its executable file, those bugs doesn't happen. I thought that when the IDE ran the program, it simply executed the program? When I run the program in debug-mode, the bugs doesn't happen either. Any one knows why this is? What sort of bugs could be the cause of this?

Thanks for any help, Oromis
It's possible the IDE is running the optimized version when you tell it to run, but the debug version when you tell it to run in debug. It's not so unusual for bugs to appear in optimized code that didn't appear in debug code.
Other than that, I would have to actually see what you're doing wrong.
Thanks for your help. While cutting down the length of the code I wanted to post, I accidentally found my bug. I was loading a new surface to a pointer before I freed the memory of the old one.

I know that code can be optimized, but how does that work? What consequences are there? I found that my compiler isn't optimizing at all at this moment, and I can choose between "optimize", "optimize more" and "best optimizion". What do you recommend?
Usually you want best optimization. The generated code executes faster.

In some weird cases that I have not yet come across, you may want something else.
Last edited on
Oke, thanks.
I should mention that when I said
It's not so unusual for bugs to appear in optimized code that didn't appear in debug code.
what I actually meant is that bugs that didn't manifest in debug code sometimes manifest in optimized code. It's not that the optimization adds those bugs. Rather, it makes them become apparent.

By the way, you shouldn't use optimizations in code you're still debugging.
what I actually meant is that bugs that didn't manifest in debug code sometimes manifest in optimized code. It's not that the optimization adds those bugs. Rather, it makes them become apparent.


Oke, that makes sense I guess.

By the way, you shouldn't use optimizations in code you're still debugging.


Good you mentioned that, you probably saved me a lot of unnoticed bugs with that :)
Topic archived. No new replies allowed.