Author Topic: Problem with Exceptions Handling (newbie)  (Read 5297 times)

HealingAura

  • Guest
Problem with Exceptions Handling (newbie)
« 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  :?

sethjackson

  • Guest
Re: Problem with Exceptions Handling (newbie)
« Reply #1 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. ;)
« Last Edit: November 29, 2006, 01:32:06 am by sethjackson »

HealingAura

  • Guest
Re: Problem with Exceptions Handling (newbie)
« Reply #2 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; }
... }

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2785
Re: Problem with Exceptions Handling (newbie)
« Reply #3 on: November 29, 2006, 01:29:43 am »

sethjackson

  • Guest
Re: Problem with Exceptions Handling (newbie)
« Reply #4 on: November 29, 2006, 01:34:00 am »

HealingAura

  • Guest
Re: Problem with Exceptions Handling (newbie)
« Reply #5 on: November 29, 2006, 02:10:22 am »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2785
Re: Problem with Exceptions Handling (newbie)
« Reply #6 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.