The type of the literal string "Error: divide by zero atempted" is 'array of n const char'
To catch the exception, catch with catch( const char* ) { ...
> when I compiled it with VS it caught it correctly
With the Microsoft compiler, disable Microsoftisms with the compiler option /Za (Disable language extensions).
With the GNU compiler, disable Linuxisms with both -std=C++14 (the language really is C++)
and -pedantic-errors (when I say C++, I mean C++ as defined by the International Standard)