How to enable exceptions in XCode - 3.2.3. Is there any flag like I should enable for the compiler for exception handling? Tried googling but didn't find enough information on XCode with C++
!
#include <iostream>
#include <exception>
int main()
{
try
{
int i=5,j=0;
int res = i/j;
}
catch (const std::exception& exe)
{
std::cerr<< exe.what();
}
catch (...)
{
std::cout<< "\n Default Exception Handler \n";
}
return 0;
}
Output:
Loading program into debugger…
Program loaded.
run
[Switching to process 1332]
Running…
Program received signal: “EXC_ARITHMETIC”.
sharedlibrary apply-load-rules all
kill
Current language: auto; currently c++
quit
The Debugger has exited with status 0.(gdb)
Edit :Though the reason seems to be different, to anyone, this figure might be helpful in future.