I need my methods to throw custom exceptions
but it keeps giving me this error :
error C2059: syntax error : 'string'
I was reading the following link but it doesn't solve my problem:
http://msdn.microsoft.com/en-us/library/t8xe60cf%28VS.80%29.aspx
This is the code I have:
#include <exception>
#include <stdexcept>
#include <string>
#include "Log.h"
LOG_USE()
class Exception : public std::exception
{
public:
explicit Exception(std::string msg)
: message(msg)
{}
~Exception()
{}
virtual const char* what() const throw()
{
LOG_MSG(message) // write to log file
return message.c_str();
}
private:
std::string message;
};
#endif
Somewhere in my app I have methods that look like this:
.....
....
void view::setDisplayView(ViewMode mode) throw(Exception("setDisplayView error"))
{
;
}
....
....
What am I doing wrong here?
I'm using Visual Studio 2008 on 32-bit Windows XP.