Ok, hi.
I have been folllowing 'SAMS Teach Youself C++' and have been going fine until the chapter on runtime errors. Here is what the compiler says:
http://img67.exs.cx/img67/9315/compiler0gp.jpg
I have 5 files:
main.cpp
ErrorHandlingModule.cpp
ErrorHandlingModule.h
PromptModule.cpp
PromptModule.h
The code that is of concern is:
CODE
default:
throw
runtime_error
("Error - Invalid operator");
- in main.cpp
CODE
catch (runtime_error RuntimeError)
{
SAMSErrorHandling::HandleRuntimeError(RuntimeError);
}
- in main.cpp
CODE
int HandleRuntimeError(runtime_error RuntimeError)
- in ErrorHandlingModule.h
CODE
int HandleRuntimeError(runtime_error RuntimeError)//returns the error code
{
cerr <<
RuntimeError.what() << endl;
return 1;//an error ocurred
}
-in ErrorHandlingModule.cpp
Please help. I don't know how to declare runtime error and in which files. I have followed the book but it is not very helpful. If you want, I can send you the whole project though e-mail or msn or something if you cant help from the information above. Thanks very much
Kris
I have been folllowing 'SAMS Teach Youself C++' and have been going fine until the chapter on runtime errors. Here is what the compiler says:
http://img67.exs.cx/img67/9315/compiler0gp.jpg
I have 5 files:
main.cpp
ErrorHandlingModule.cpp
ErrorHandlingModule.h
PromptModule.cpp
PromptModule.h
The code that is of concern is:
CODE
default:
throw
runtime_error
("Error - Invalid operator");
- in main.cpp
CODE
catch (runtime_error RuntimeError)
{
SAMSErrorHandling::HandleRuntimeError(RuntimeError);
}
- in main.cpp
CODE
int HandleRuntimeError(runtime_error RuntimeError)
- in ErrorHandlingModule.h
CODE
int HandleRuntimeError(runtime_error RuntimeError)//returns the error code
{
cerr <<
RuntimeError.what() << endl;
return 1;//an error ocurred
}
-in ErrorHandlingModule.cpp
Please help. I don't know how to declare runtime error and in which files. I have followed the book but it is not very helpful. If you want, I can send you the whole project though e-mail or msn or something if you cant help from the information above. Thanks very much
Kris