Platoon
6th October 2009, 10:08
Hi. I have a short test program and i need help concerning include files.
here is the code:
#ifndef CPROTOCOL_H
#define CPROTOCOL_H
#include "cpacket.h"
class CProtocol
{
private:
CPacket *mPacketList;
public:
CProtocol();
};
#endif // CPROTOCOL_H
#ifndef CPACKET_H
#define CPACKET_H
#include "cprotocol.h"
class CPacket
{
private:
CProtocol *parent;
public:
CPacket();
};
#endif // CPACKET_H
The compiler exits with return value 2 and says "In file included from cprotocol.h:4,"
I know that it has something to do with the recursive including of the two files but i think the #ifndef should prevent this.....
i hope someone can tell me what i'm doing wrong
here is the code:
#ifndef CPROTOCOL_H
#define CPROTOCOL_H
#include "cpacket.h"
class CProtocol
{
private:
CPacket *mPacketList;
public:
CProtocol();
};
#endif // CPROTOCOL_H
#ifndef CPACKET_H
#define CPACKET_H
#include "cprotocol.h"
class CPacket
{
private:
CProtocol *parent;
public:
CPacket();
};
#endif // CPACKET_H
The compiler exits with return value 2 and says "In file included from cprotocol.h:4,"
I know that it has something to do with the recursive including of the two files but i think the #ifndef should prevent this.....
i hope someone can tell me what i'm doing wrong