ncurses library安装

问题:
编译Linux内核时会提示:
Unable to find the ncurses libraries or the required header files.
'make menuconfig' requires the ncurses libraries.
Install ncurses (ncurses-devel) and try again.
 
ncurses是字符终端下屏幕控制的基本库,能提供功能键定义(快捷键)、屏幕绘制以及基于文本终端的图形互动功能的动态库。
 
解决方法
执行命令
sudo apt-get install libncurses5-dev 
make menuconfig

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The `getch()` function is a blocking input function in the ncurses library of Linux. It waits for the user to press a key on the keyboard and returns the corresponding integer value of the key pressed. Here is a simple example of using `getch()` to read a single character from the user: ``` #include <ncurses.h> int main() { initscr(); // initialize ncurses cbreak(); // don't wait for the Enter key to be pressed noecho(); // don't print the character on the screen keypad(stdscr, TRUE); // enable function keys printw("Press any key to continue..."); refresh(); // redraw the screen getch(); // wait for a keypress endwin(); // restore terminal settings return 0; } ``` In this example, `initscr()` initializes ncurses, `cbreak()` puts the terminal into cbreak mode (which means input is immediately available to the program without waiting for the Enter key to be pressed), `noecho()` disables the automatic printing of input characters to the screen, and `keypad()` enables function keys. The `printw()` function prints a message to the screen, and `refresh()` redraws the screen. Finally, `getch()` waits for a keypress, and `endwin()` restores the terminal settings before exiting the program. Note: The return value of `getch()` is an integer, but most keys on the keyboard have an ASCII code that corresponds to their value. For example, the ASCII code for the 'A' key is 65. You can use `getch()` to read the ASCII code of a key by casting the result to a `char`. For example: ``` char ch = (char)getch(); ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值