Release and Debug mode

Started by
9 comments, last by c0mas 18 years, 6 months ago
Hello, I currently write a physics engine, but I meet a strange problem. I use VS2003, so we know release mode is much faster than debug mode when you press F5 to start program, and it can be more faster when you double click in the folder directly to run the program. my problem is: it cause an error which I always can't resolve when I run it directly in the folder, but runs OK when I start program in VS2003 with release mode. What could I do? Thanks!!
Advertisement
To run the executable directly, you need to move it to the root folder of the project. Just take it out of the release folder and put it one directly up, and it should run properly.
Quote:Original post by SiliconMunky
To run the executable directly, you need to move it to the root folder of the project. Just take it out of the release folder and put it one directly up, and it should run properly.


Yes, my executalbe file have been moved to the root folder already. In fact, I have set the "$(ProjectDir)" as the output directory.
Use "Ctrl+F5" is as same as run it directly. so I just can use F5 to start my program.
hmmm that is very strange, are you able to run the debug exe file from the folder? what actually happens when is crashes?
Something similar happend to me in VC6.0.
I had some uninitialized variabiles and strange running from IDE worked ok, but from command line crashed (due to different memory loading or so).
If you have a "trace" debug command you may find where it crashes (place lots of traces and see how much it goes). And then you may find the cause.
Quote:Original post by SiliconMunky
hmmm that is very strange, are you able to run the debug exe file from the folder? what actually happens when is crashes?


Yes, I can run the debug exe file fine.

Quote:
If you have a "trace" debug command you may find where it crashes (place lots of traces and see how much it goes). And then you may find the cause.


In fact, I have pressed "Debug" button when it crashes, so I enter the VS2003, though I can see where it goes, I can't see any value of variables, this is why I don't know how to resolve it. Now I have to rewrite that function use another method.
I think c0mas is right, it is (due to different memory loading or so).
You need to make sure your initializing all, and I mean ALL, your variables explicitly. Don’t rely on un-initialized variables.
As Gain says.

In Debug everything is pretty much failsafe, namely your variable sget initialised for you. In release they don't, so you have to do it yourself.

ace
Just fprintf your variabiles in a file and you'll see your variabiles on release too. (open the file every time and close it after each fprintf so you don't loose any data on crash).

Or use OutputDebugString (I think that's the name of the function).
Quote:Original post by c0mas
Just fprintf your variabiles in a file and you'll see your variabiles on release too. (open the file every time and close it after each fprintf so you don't loose any data on crash).

Or use OutputDebugString (I think that's the name of the function).


Can you not use the flush() method to effectively do the same thing?
ToDoList.GrowthRate = WorkRate*2, it's more efficient to not work.

This topic is closed to new replies.

Advertisement