Page 1 of 1

Runtime error with try catch o.o

Posted: Fri Jun 26, 2015 3:07 pm
by Tapsa
I recently upgraded my compiler to MinGW 4.9.1 from MinGW 4.6.2.
I am also trying wxWidgets 3.0.2 coming from 2.8.12.

This code runs fine when put into widgets sample, but when I use it in my very big and complex wxWidgets project, it results in C Runtime error and the program exits. That is, if the lexical cast fails and catch happens.

Code: Select all

    int32_t result = 9000;
    try
    {
        result = boost::lexical_cast<int32_t>("42u");
    }
    catch(boost::bad_lexical_cast e)
    {
        result = 24;
    }
How can this be so? Only a header file is even needed for those lexical cast functions.