小编use*_*285的帖子

未定义的对ncurses库中函数的引用

我试图使用ncurses库v 5.9编译以下代码.关于Debian wheezy.但我正在未定义参考图书馆的功能.我从源代码安装了库.

#include <curses.h>
#include <menu.h>
#include<stdlib.h>

#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define CTRLD   4

char *choices[] = {
                    "Choice 1",
                    "Choice 2",
                    "Choice 3",
                    "Choice 4",
                    "Exit",
              };

int main()
{   ITEM **my_items;
int c;              
MENU *my_menu;
int n_choices, i;
ITEM *cur_item;


initscr();
cbreak();
noecho();
keypad(stdscr, TRUE);

n_choices = ARRAY_SIZE(choices);
my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));

for(i = 0; i < n_choices; ++i)
        my_items[i] = new_item(choices[i], choices[i]);
my_items[n_choices] = (ITEM *)NULL;

my_menu = new_menu((ITEM **)my_items);
mvprintw(LINES …
Run Code Online (Sandbox Code Playgroud)

c linux gcc ncurses

0
推荐指数
1
解决办法
3038
查看次数

标签 统计

c ×1

gcc ×1

linux ×1

ncurses ×1