I have a packet class and a packetfactory class.
In packet factory class it includes packet.h file and in packet class it includes packetfacotry.h file.
Then I am getting an error “packet does not name a type ” in packetfactory.h file.
How do I fix this?
Thanks in advance.
2 ways :
First, you can
#include "packet.h"in packetfacotry and#include "packetfacotry.h". DO NOT forget to protect your headers.Second, if you have an circular inclusion juste add
class packet;in your “packetfacotry.h. file or vice versa.It declares symbols for preprocessor.
So ?