刚开始学习,按照教材上输入
#include <curses.h>
main()
{
int i;
initscr();
clear();
for (i=0;i<LINES;i++)
{
move(i,i+i);
if (i%2==1)
standout();
addstr("Hello,world");
if (i%2==1)
standend();
refresh();
sleep(1);
move(i,i+i);
addstr(" ");
}
endwin();
}
编译时
$ gcc hello.c -o hello
hello.c:22:2: warning: no newline at end of file
/tmp/cc8C4vmd.o(.text+0x1d): In function `main':
: undefined reference to `initscr'
/tmp/cc8C4vmd.o(.text+0x26): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0x2b): In function `main':
: undefined reference to `wclear'
/tmp/cc8C4vmd.o(.text+0x3e): In function `main':
: undefined reference to `LINES'
/tmp/cc8C4vmd.o(.text+0x57): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0x5c): In function `main':
: undefined reference to `wmove'
/tmp/cc8C4vmd.o(.text+0x7f): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0x96): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0x9b): In function `main':
: undefined reference to `waddnstr'
/tmp/cc8C4vmd.o(.text+0xbe): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0xce): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0xd3): In function `main':
: undefined reference to `wrefresh'
/tmp/cc8C4vmd.o(.text+0xf6): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0xfb): In function `main':
: undefined reference to `wmove'
/tmp/cc8C4vmd.o(.text+0x10e): In function `main':
: undefined reference to `stdscr'
/tmp/cc8C4vmd.o(.text+0x113): In function `main':
: undefined reference to `waddnstr'
/tmp/cc8C4vmd.o(.text+0x125): In function `main':
: undefined reference to `endwin'
collect2: ld returned 1 exit status