Tuesday, July 28, 2009

Oh what fun it would be: a compiler with useful error messages

the code:

#include "common.hpp"


template<typename ACHAR>
class GameException
    : public std::exception
{
  public:
    GameException()                             throw();
    GameException(const ACHAR*)                 throw();
    GameException(const basic_string<ACHAR>&)   throw();
    virtual ~GameException()                    throw();
    virtual const ACHAR* what()                 const throw();
  protected:
    const ACHAR *why;
};

the error:

s:\visual studio 2008\projects\tacfpsgame\projectname\source\include\gameexceptions.hpp(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


the solution:


fully qualify basic_string<> as std::basic_string<ACHAR>, or add 'using std::basic_string' to common.hpp along side std::string and std::wstring, like I thought I did last week !!!


simple fact: compiler errors usually suck, and C++ templates don't help any.

No comments:

Post a Comment