以下 C++ 代码正在生成此错误:
error C2061: syntax error : identifier 'IObject'
这是我的代码:
文件:IObject.h
#include "IIStreamable.h"
using namespace Serialization;
namespace Object
{
class IObject : public IIStreamable
{
virtual void AcceptReader( IIReader* reader );
virtual void AcceptWriter( IIWriter* writer );
};
}
文件:IIWriter
#include "IObject.h"
#using namespace Object;
namespace Serialization
{
class ICORE_API IIWriter
{
public:
// primitive "built in" value types
virtual void writeChar(const char) =0;
virtual void writeUChar(unsigned char) =0;
virtual void writeCharPtr(const char*) =0;
virtual void writeUCharPtr(const unsigned char*) =0;
virtual void writeLong(long) =0;
virtual void writeULong(unsigned long) =0;
virtual void writeShort(short) =0;
virtual void writeUShort(unsigned short) =0;
virtual void writeInt(int) =0;
virtual void writeUInt(unsigned int) =0;
virtual void writeFloat(float) =0;
virtual void writeDouble(double) =0;
virtual void writeBool(bool) =0;
virtual void writeObject(IObject*) =0;
};
}
文件:IIStreamable
#include "IIReader.h"
#include "IIWriter.h"
namespace Serialization
{
class ICORE_API IIStreamable
{
public:
virtual void AcceptReader(IIReader*) = 0;
virtual void AcceptWriter(IIWriter*) = 0;
};
}
在 vc++ 2010 中编译此代码后,我收到此错误
错误 C2061:语法错误:标识符“IObject”
在 IIWriter.h 文件中和
错误 C2061:语法错误:标识符“IIWriter”
在 IObject.h 文件中和
错误 C2061:语法错误:标识符“IIWriter”
在 IIStreamale.h 文件中。
我不明白为什么会发生这个错误?
请帮我
谢谢