LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 805|回复: 2

一个屏幕显示的程序出现的错误,请各位高手指点一下

[复制链接]
发表于 2006-5-13 09:18:52 | 显示全部楼层 |阅读模式
我本来想写一个小游戏,结果发现我的许多curses函数不能用,于是我写了一个测试小程序,请大家指点一下。源代码如下:
#include <stdio.h>
#include <curses.h>

main()
{
               
        initscr();
        clear();
        move(10,20);
       
        addstr("AAAAAA");

        move(LINES-1,0);
       
        refresh();
        getch();
        endwin();
}

错误显示如下:
/tmp/ccEmDUvu.o(.text+0x11): In function `main':
/home/code2/hello.c:8: undefined reference to `initscr'
/tmp/ccEmDUvu.o(.text+0x1a):/home/code2/hello.c:9: undefined reference to `stdscr'
/tmp/ccEmDUvu.o(.text+0x1f):/home/code2/hello.c:9: undefined reference to `wclear'
/tmp/ccEmDUvu.o(.text+0x32):/home/code2/hello.c:10: undefined reference to `LINES'
/tmp/ccEmDUvu.o(.text+0x47):/home/code2/hello.c:11: undefined reference to `stdscr'
/tmp/ccEmDUvu.o(.text+0x4c):/home/code2/hello.c:11: undefined reference to `wmove'
/tmp/ccEmDUvu.o(.text+0x76):/home/code2/hello.c:13: undefined reference to `stdscr'
/tmp/ccEmDUvu.o(.text+0x8d):/home/code2/hello.c:14: undefined reference to `stdscr'
/tmp/ccEmDUvu.o(.text+0x92):/home/code2/hello.c:14: undefined reference to `waddnstr'
/tmp/ccEmDUvu.o(.text+0xb5):/home/code2/hello.c:16: undefined reference to `stdscr'
/tmp/ccEmDUvu.o(.text+0xc5):/home/code2/hello.c:17: undefined reference to `stdscr'
/tmp/ccEmDUvu.o(.text+0xca):/home/code2/hello.c:17: undefined reference to `wrefresh'
/tmp/ccEmDUvu.o(.text+0xd6):/home/code2/hello.c:18: undefined reference to `stdscr'
/tmp/ccEmDUvu.o(.text+0xdb):/home/code2/hello.c:18: undefined reference to `wgetch'
/tmp/ccEmDUvu.o(.text+0xe3):/home/code2/hello.c:19: undefined reference to `endwin'
collect2: ld returned 1 exit status

谢谢

P.S 我用的是RH9.0,如果必要的话,我会把curses.h的源码贴出来。
发表于 2006-5-13 09:50:44 | 显示全部楼层
编译时没有链接curses库。
回复 支持 反对

使用道具 举报

发表于 2006-5-13 13:51:19 | 显示全部楼层
请看这篇文章,里面说了怎样安装和使用curses库
http://my.opera.com/419/blog/show.dml/213948
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表