2009-11-12 144 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安裝,所涉及的資產可能中找到

相關問題