Undefined reference to...
Having this class
....
// class for managing the low level packets
class Packet
{
private:
char type;
virtual void writeBuffer();
protected:
char buffer[MAX_SIZE];
size_t real_size;
public:
// when we construct it directly we hmust give in the stream
Packet(char _type) : type(_type) {}
friend ostream& operator<<(ostream& s, const Packet& c);
// virtual bool operator==(const Packet&) const = 0;
static Packet parseStream(const Stream&);
// implement a sending mechanism inside here
void sendMulticast();
};
What I just want to do is that this is implemented by the class
inheriting from Packet.
virtual void writeBuffer();
But actually every time I try to virtualize something I get
Undefined symbols:
"typeinfo for Packet", referenced from:
typeinfo for Beaconin Beacon.o
"vtable for Packet", referenced from:
Packet::Packet(char)in Beacon.o
Packet::Packet(Packet const&)in Packet.o
Now I found this link
http://lifecs.likai.org/2009/03/c-undefined-vtable-symbol.html
which was the only clear explanation, but still I don't get it, the ONLY
class that inherits from Packet HAS writeToBuffer implemented.
So what can that be?
Without any virtuals everything works perfectly..