[Exception] message erreur incomprehensible pour classe exception
bonjour,
j'essaie de developper une classe d'exception.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#ifndef pal_error_h
#define pal_error_h
#include <exception>
#include <string>
namespace pal {
//! Central error handling class
class palException : public std::exception
{
public:
//constructor
palException(const std::string& msg=" pal exception"): m_message(msg),std::exception() {}
palException(const std::string& file,int line,const std::string& msg ="pal exception",const std::string& obj="")
: m_message(_makeErrorMessage(file,line,msg,obj)),std::exception() {}
//copy constructor
palException(const palException& e): m_message(e.m_message),std::exception(e) {}
// assigenment operator
palException& operator=(const palException& e);
virtual const char* what() const throw() { return m_message.c_str(); }
//destructor
virtual ~palException() throw() {}
private:
static std::string _makeErrorMessage(const std::string& file,int line,const std::string& msg,const std::string& obj);
std::string m_message;
};
/*
This macro adds some short-hand functionality by including filename
and line number in the error message.
*/
#define palERROR(msg,obj) palException(__FILE__,__LINE__,msg,obj)
} // namespace pal
#endif // pal_error_h |
dans le fichier .cpp j'implement la function static _makeErrorMesage et ;'operator =
a lui tout seul, le fichier compile sur visual Studio 2003 mais lorsque j'essaie de compiler toute ma solution j'obtiens:
Citation:
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\errors.h(29): error C2065: 'AMGETERRORTEXTPROCA' : undeclared identifier
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\errors.h(29): error C2065: 'WINAPI' : undeclared identifier
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\errors.h(29): error C2501: 'BOOL' : missing storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\errors.h(29): fatal error C1903: unable to recover from previous error(s); stopping compilation
distributions error LNK2019: unresolved external symbol "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl pal::palException::_makeErrorMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?_makeErrorMessage@palException@pal@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@H00@Z) referenced in function "public: __thiscall pal::palException::palException(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0palException@pal@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H00@Z)
distributions fatal error LNK1120: 1 unresolved externals
est ce que quelqu'un a une idee de ce qui se passe?
merci
K