This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Enable C++ Exception Handling

I am using (MVL 5.0 Tools) to compile c++ codes to DM368.

Here is my test.cpp code:

#include<stdio.h>

int main()

{

        try {

                throw 1;

        }

        catch(int) {

                printf("Catch\n");

        }

        return 0;

}
 

and my compile command:
/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-g++ -fexceptions test.cpp


When executing the program, the program display the message:

terminate called after throwing an instance of 'int'

terminate called recursively

Aborted


It seems the exception is not caught.
Does anyone know how to enable C++ exception handling?