我已经编写了一个实验库,并且正在研究我已经得到的 Array error: unknown class name 'Exception'; did you mean 'std::exception'
。我该如何解决?
数组.hpp
#ifndef _RFwC__ARRAY_HPP_
#define _RFwC__ARRAY_HPP_
#include "util.hpp"
#include "Object.hpp"
#include "IDefaultType.hpp"
#include "Exception.hpp"
class ArrayException : public Exception {}; // here error
class IndexOutOfRangeException : public ArrayException {};
template<typename T_Value>
class Array : public Object, IDefaultType{
public:
Array(const intnum_t _length);
Array();
// next array code and closing for guard symbols
异常.hpp
#ifndef _RFwC__EXCEPTION_HPP_
#define _RFwC__EXCEPTION_HPP_
#include "IThrowable.hpp"
#include "Object.hpp"
#include "String.hpp"
class Exception : public Object, IThrowable {
public:
Exception(const String _message, const Exception * _pInner);
Exception(const String _message);
Exception();
const String getMsg() const;
const Exception * getInner() const;
virtual void onThrow();
protected:
String __msg;
const Exception * __pInner;
};
#endif // _RFwC__EXCEPTION_HPP_
输出:
c++ -DPLATFORM_=linux -DCAPACITY_=32 -std=c++11 -fPIC -o obj/core_Exception.cpp.o -c src_Core/Exception.cpp
In file included from src_Core/Exception.cpp:23:
In file included from src_Core/Exception.hpp:26:
In file included from src_Core/IThrowable.hpp:27:
In file included from src_Core/String.hpp:28:
src_Core/Array.hpp:31:31: error: unknown class name 'Exception'; did you mean 'std::exception'?
class ArrayException : public Exception {};
^~~~~~~~~
std::exception
/usr/bin/../lib/gcc/i686-linux-gnu/4.7/../../../../include/c++/4.7/exception:61:9: note: 'std::exception' declared here
class exception
^
1 error generated.
make: *** [core_Exception.cpp.o] Ошибка 1