2009-11-12 92 views
1

我正在编译一个在shell上创建窗口的程序。当我编译我得到这样的错误错误原因和解决方法 - “未定义的引用newwin'”?

test.c:(.text+0x25): undefined reference to `newwin' 
test.c:(.text+0x73): undefined reference to `wborder' 
test.c:(.text+0xb6): undefined reference to `mvwprintw' 
.. 
.. 

我的一个功能是

WINDOW *f_top, *f_bottom; 
WINDOW *create_window(int n, int d, char *t){ 
     WINDOW *frame; 
     WINDOW *w; 
     frame = newwin(n, COLS, d, 0); 
     box(frame,0,0); 
     mvwprintw(frame,0,COLS/2-strlen(t)/2,t); 
     wrefresh(frame); 
     w = newwin(n-2, COLS-2, d+1, 1); 
     idlok(w, TRUE); 
     scrollok(w, TRUE); 
     wclear(w); 
     wrefresh(w); 
     return w; 
} 

回答

3

您需要用诅咒库进行链接。功能在那里定义。

尝试

gcc ... test.c ... -lcurses ... 

也许

gcc ... test.c ... -lncurses ... 
+0

谢谢!!!!!! – 2009-11-12 09:22:52

0

更明确,

首先你需要的,如果需要安装诅咒(或ncurses的)库。

其次,包括curses.h

第三,这些都需要被发现,你可能与$ PATH的问题。

最后,根据读取后多久,可能会有'弃用'功能。 - 在curses.h(然后是网页)中搜索名称。

/usr/lib/x86_64-linux-gnu/libncurses.so

/usr/include/curses.h:

通常为64位Linux安装,所涉及的资产可能中找到

相关问题