Try to include <ncurses.h>
as well.
And be sure that it is properly installed on your distro, and that you link it correctly at compilation.
If you still have trouble, check where the files are.
$sudo updatedb
$locate curses.h
$locate ncurses.h
Edit:
From the error you pasted, it shows that it's not a problem of header inclusion. LD (the linker) can't find the symbol associated to key_name. Which means that your are not compiling with the correct libray (maybe path issues) or that you need an extra one, or that key_name does'nt exist in the version you are trying to use.
And I think you are not passing the good parameter in the function, you are using "wint_t" instead of "wchar_t", It might be why it can't find the function.
And also try -lcurses in addition