Hi all, I'm using GNU G++ for my development.
I have write a simple test case.The program runs and exited normally
inside
the debugger (GDB) but when I tries to run it without debugger it
crashes.
I can't pinpoint the error.
Any new idea how to overcome this problem? Any debugging tip is fine.
Your issue is not directly a language question.
You would be likely to get more and better help
if you went to a news group that had to do with
your compiler, and maybe your operating system
and hardware.
However: Crashes of this sort have generic causes.
Look for things like:
- running off the end of an array or block of
allocated memory, front or back
- using an invalid pointer such as a pointer
to memory that has been deallocated
- bad casts, especially of pointers
- off-by-one errors where you reference the
next or previous item in a series when that
item does not exist or does not behave as you want
- referencing resources (of any kind) before they
are allocated and initialized, or after they
are deallocated
- using a variable's content before it is initialized
There are a few more, but I've only had one
cup of coffee this AM.
And there are generic solutions. For example,
reduce your use of arrays by switching to the
standard library container classes.
For long term improvement, get books like
Effective C++ by Scott Meyers.
Socks