The same code is working fine on gcc 4.5.2 but when trying to compile it on gcc 4.1.2, I get the error ‘runtime_error’ was not declared in this scope.
‘runtime_error’ was not declared in this scope
I do
Do you have using namespace std; or using std::runtime_error;? If not, then you need to fully qualify the name and use std::runtime_error rather than just runtime_error.
using namespace std;
using std::runtime_error;
std::runtime_error
runtime_error