Hi,
I'm trying to use buttons on a PC Keyboard to simulate buttons on my target device, making it easier to drive a user interface rather than clicking individual I/O pins with the mouse. I was planning to use the PC cursor keys to emulate a keypad, with other keys emulating an ok and esc button.
My thought was to add a variable KeyBoardCode into the WM_KEYDOWN event in WndProc() in WinSimMain.cpp, I could then examine this variable in my code to check for a keypress. I was planning to wrop this test so it was only compiled if running in simulation mode.
case WM_KEYDOWN:
KeyBoardCode = wParam;
if (0x10 == wParam) { // shift key down {11}
iShiftPressed = 1;
}
#ifdef SUPPORT_KEY_SCAN
else if (VK_ESCAPE == wParam) { // ESC key pressed
iInputChange = fnCheckKeypad(-1, -1, 0);
}
#endif
break;
I defined KeyBoardCode in application.c
unsigned int KeyBoardCode;
And put an extern reference to it in application.h
extern unsigned int KeyBoardCode;
When I compile this I get the error
Error 1 error LNK2001: unresolved external symbol "unsigned int KeyBoardCode" (?KeyBoardCode@@3IA) WinSimMain.obj uTasker
Even though I know application.h is included via config.h in WinSimMain.cpp.
I'm not sure whats happening here, is it because I trying to include a variable defined in a C file in a C++ file?
Any help greatly appreciated
Cheers
Martin