I'm facing an error I dont understand.
I try to create and use a static array of method pointers. The declaration in my class looks like this:
static void (Client::*packetHandler[Op::handledOpcodeMax - Op::handledOpcodeMin + 1])(QByteArray &data);
Initialization takes place in my .cpp files is like that:
void (Client::*packetHandler[Op::handledOpcodeMax - Op::handledOpcodeMin + 1])(QByteArray &data);
Here comes the troubles, in one of my Client's class method I try to use this methods pointers' array. I tried several ways, for example :
(this->*packetHandler[_opcode])(data);
I said I didnt understand the problem, let me explain why. Running make on my code results in a proper compilation, tought, there is a problem when linking.
client.cpp:71: undefined reference to `Client::packetHandler'
This message is repeated 5 times.
Any help would be welcome. Thank you.