OK, Im getting a few unresolved externals for some code, and I cant for the life of me figure out why. My googling didnt find anything I could figure out my situation from. Im running VS 2008 on a vista notebook.
In a .h there is this:
typedef struct _input_event
{
_input_event();
~_input_event();
int type;
int key;
} INEVENT, *LPINEVENT;
and in the matching .cpp:
void (*EventHandler)(LPINEVENT) = NULL;
//in here some code to set a void func that takes a LPINEVENT
if ( !(old_keystates == new_keystates) )
{
LPINEVENT inevent = new INEVENT;
for (key = 0; key < 256; key++)
{
if ( (old_keystates[key] == STATE_UP) && (new_keystates[key] == STATE_DOWN) )
{
inevent->type = KEY_PRESS;
inevent->key = key;
(*EventHandler)(inevent);
}
}
delete inevent;
}
}
The two errors Im getting are as follows:
1>SYS_INPUT.obj : error LNK2001: unresolved external symbol "public: __thiscall _input_event::_input_event(void)" (??0_input_event@@QAE@XZ)
1>SYS_INPUT.obj : error LNK2001: unresolved external symbol "public: __thiscall _input_event::~_input_event(void)" (??1_input_event@@QAE@XZ)
(naturally and a third telling me there is these 2)
I havent used function pointers all that terribly much, but when trying the examples in that "learn c++ in 21 days" they worked fine.