I’m building a C++ application and need to use PDCurses on Windows. I’m compiling with VC++ from MS VS 2005 and I’m getting a link error.
error LNK2019: unresolved external symbol __imp__GetKeyState@4 referenced in function __get_key_count
There are 11 errors all with the same error code and different symbols. The missing symbols are __imp__MapVirtualKeyA@8, __imp__FindWindowA@8, __imp__wsprintfA, __imp__SendMessageA@16, __imp__GetWindowThreadProcessId@8, __imp__MessageBeep@4. It is almost like the VC++ can’t find the appropriate ASCII implementations of these functions. I should also note that the demo programs that come with PDCurses compiled fine, though they are C programs.
In the C++ program, I include the header using
extern 'C' { #include <curses.h> }
I’m sure I’m forgetting to link against some C standard library, but I’m not sure which one.
GetKeyState() is a Windows function in ‘user32.dll’, so you need to be sure you’re linking against ‘user32.lib’. You may also need to make sure it comes after the PDCurses library in the list of linker libraries, too.