It is a huge code. I cannot post it. It works fine when ran from the debugger both under debug and release mode but when running the executable under exactly identical circumstances produce a different result.
Its just like asking a doctor that you are sick and give you a medicine, where you can't tell the doctor that what is wrong with you, neither you let him examine you
There can be so many things that go wrong, such as un-initialization of something (as pointed out by GCDEF) or if you are using floats/doubles then due to floating point inaccuracy, you may get different numerical results, who knows...
Try to replicate the issue in a small test program and post it here.
It works fine when ran from the debugger both under debug and release mode but when running the executable under exactly identical circumstances produce a different result.
You are not running the program "under exactly identical circumstances". One way, you're running under the debugger, and in another way, you're not running under a debugger. Those are two different circumstances. If your C++ program has certain types of bugs, then there is no guarantee how it will run or what results you will get. It could even run OK today and not run OK tomorrow.
As others pointed out,
1) You may have uninitialized variables -- this means that your program will exhibit undefined behaviour.
2) You may not be checking all return values from functions you're calling, causing your program to exhibit undesired behaviour.
3) You may be expecting to read values from a file, and the file doesn't exist or it's the wrong file (again, causing different behaviour).
4) You may be overrunning the boundaries of an array or trashing memory in some other way, meaning your program will exhibit undefined behaviour.
I can list many more things.
It is a huge code. I cannot post it.
So what do you want us to do? We can't solve problems without seeing what you're doing.
All I can say is that your program has a bug, and you need to debug it. Having a program behave differently when run under a debugger, on another computer, on a different day of the week, etc. is not uncommon, and it's all due to the items I listed above (and even more reasons I didn't list).
Regards,
Paul McKenzie
Last edited by Paul McKenzie; July 5th, 2012 at 08:31 PM.
It is a huge code. I cannot post it. It works fine when ran from the debugger both under debug and release mode but when running the executable under exactly identical circumstances produce a different result.
Bookmarks