Question

sorry for my bad english. I make app in c with ncurses-5.9 lib. In docs for lib ( ncurses-5.9/doc/html/man/curs_util.3x.html ) I found what function key_name defined in curses.h, but if I include curses.h, I still get error key_name was not declared in this scope.

What i need to do for to use key_name function?

Was it helpful?

Solution

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

OTHER TIPS

For use key_name we must use libncursesw5-dev instead of libncurses5-dev.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top