Code::Blocks Forums

User forums => Help => Topic started by: HealingAura on November 28, 2006, 11:36:05 pm

Title: Problem with Exceptions Handling (newbie)
Post by: HealingAura on November 28, 2006, 11:36:05 pm
Hello,
I am trying to use Exceptions Handling in my C++ program but instead I keep getting this:

"This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information."

Instead of getting the right error text printed, this text above shows up and the program quits.

Did I forgot to enable something? Something tells me it's not supposed to happen  :?
Title: Re: Problem with Exceptions Handling (newbie)
Post by: sethjackson on November 29, 2006, 12:48:37 am
It should work (if your code is right), and you haven't passed -fno-exceptions to GCC (assuming GCC).
C++ exception handling works fine for me. BTW this isn't a programming forum. ;)
Title: Re: Problem with Exceptions Handling (newbie)
Post by: HealingAura on November 29, 2006, 01:18:29 am
I use GCC compiler but I don't see this -fno-exceptions. Any idea why I get this message?

The code looks like this:

int FunctionName()
{....
     switch (num)
     { ..... default: throw "invalid number"; }
... }

int main()
{ ...
   try { ... FunctionName(); ... }
   catch(char *msg) { cout<<msg<<endl; }
... }
Title: Re: Problem with Exceptions Handling (newbie)
Post by: Pecan on November 29, 2006, 01:29:43 am
BTW this is a programming forum. ;)

???
Title: Re: Problem with Exceptions Handling (newbie)
Post by: sethjackson on November 29, 2006, 01:34:00 am
BTW this is a programming forum. ;)

???

 :lol: :lol: :lol: :oops:

isn't :P
Title: Re: Problem with Exceptions Handling (newbie)
Post by: HealingAura on November 29, 2006, 02:10:22 am
BTW this is a programming forum. ;)

???

 :lol: :lol: :lol: :oops:

isn't :P
Am I in the wrong forum?  :oops:
Title: Re: Problem with Exceptions Handling (newbie)
Post by: Pecan on November 29, 2006, 02:39:56 pm
Am I in the wrong forum?  :oops:
Sorry about that.
Programming questions on this forum should be related to the *use* of CodeBlocks. Not general questions concerning programming.