Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Overtaker on March 03, 2014, 07:59:40 pm

Title: Get last error output
Post by: Overtaker on March 03, 2014, 07:59:40 pm
Hello.

From time to time I struggle with error that just write a message to the console, and immediately close whole program.
My question is how to read such errors. I guess the easiest way would be to prevent console from closing, or by setting a breakpoint, but none of theese worked.
It would be good to redirect the console output to a file. How can such thing be done in Code::Blocks? Or if it can't, is there any other workaround, that would allow me to debug such errors? I'm working on Windows.

Thanks.
Title: Re: Get last error output
Post by: BlueHazzard on March 03, 2014, 09:07:49 pm
sorry to say that to you, but this is not a c::b related question, but a general programming/debugging/output redirecting question...
so this question will probably be locked. Read the forum rules for more detail.

to give you a hint:
your program can (obviously) be started from outside c::b and so you can redirect the output to a file with the > command.
Title: Re: Get last error output
Post by: Overtaker on March 03, 2014, 09:13:53 pm
I thought debugging is related to using code::blocks. Sorry if it's in wrong category.

And, oh my... I never thought of running it in simple cmd. Okay, thread can be closed. I look stupid now. :) Thank you.
Before the topic gets locked, is there any way of displaying exception messages, like the ones I mentioned in visual studio way, eg. a dialog message, or just anything output to code::blocks?
Title: Re: Get last error output
Post by: BlueHazzard on March 03, 2014, 09:27:55 pm
What compiler? and what debugger? What exceptions (using throw?)?
I don't know how visual studio handles exceptions..
if you are using gdb you can try to make a tick under Settings->Debugger->Default->catch c++ exceptions

or you do it manually by typing a command in the "gdb command line". See http://www.delorie.com/gnu/docs/gdb/gdb_31.html