我已经查看了这个问题,但没有看到问题出在哪里。我不是 C++ 专家,所以对我来说这看起来不错。我上次尝试时,这曾经编译没有问题。
namespace yaaf {
/************************************************************************/
/*                                                                                          */
/*     Standard YAAF Errors                                                            */
/*                                                                                          */
/************************************************************************/
/*     XGYAAFError
 *
 *          YAAF Error; this is the root of my YAAF errors, and is
 *     a descendant of the standard exception class
 */
class XGYAAFError : public std::exception {
     public:
          explicit XGYAAFError(const char *);
          explicit XGYAAFError(const std::string &err);
          const char *what() const throw()
          {
              return fError.c_str();
          }
     private:
          std::string fError;
};
} // namespace yaaf
#endif
GCC 库基类...
  /**
   *  @brief Base class for all library exceptions.
   *
   *  This is the base class for all exceptions thrown by the standard
   *  library, and by certain language expressions.  You are free to derive
   *  your own %exception classes, or use a different hierarchy, or to
   *  throw non-class data (e.g., fundamental types).
   */
  class exception 
  {
  public:
    exception() throw() { }
    virtual ~exception() throw();
    /** Returns a C-style character string describing the general cause
     *  of the current error.  */
    virtual const char* what() const throw();
  };
错误“覆盖函数的规范比基本版本更宽松”是我现在尝试构建时得到的。
我认为这可能与 C++ 语言的变化(大约 2004 年??)以及您可以在派生类中声明指针的位置有关。但我不确定这里是否是这种情况以及如何解决这个问题。
任何关于具体错误或如何解决此问题的想法都值得赞赏。
谢谢