LinuxSir.cn,穿越时空的Linuxsir!

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

关于curses编程

[复制链接]
发表于 2006-4-3 18:11:46 | 显示全部楼层 |阅读模式
在调用curses.h文件后 编译时出现以下问题是为什么 ?
库文件里的curses.h已经安装,而且,像'stdscr'已经是curses.h里给定义了的
高手指点
//tmp/ccwBoMEh.o(.text+0x44): In function `main':
curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x49):curse.c: undefined reference to `wborder'
/tmp/ccwBoMEh.o(.text+0x5c):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x61):curse.c: undefined reference to `wattr_on'
/tmp/ccwBoMEh.o(.text+0x71):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x76):curse.c: undefined reference to `wmove'
/tmp/ccwBoMEh.o(.text+0x8e):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x93):curse.c: undefined reference to `waddnstr'
/tmp/ccwBoMEh.o(.text+0xa6):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0xab):curse.c: undefined reference to `wattr_off'
/tmp/ccwBoMEh.o(.text+0xbd):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0xc2):curse.c: undefined reference to `wmove'
/tmp/ccwBoMEh.o(.text+0xea):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0xef):curse.c: undefined reference to `wgetch'
/tmp/ccwBoMEh.o(.text+0xfe):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x103):curse.c: undefined reference to `wgetch'
/tmp/ccwBoMEh.o(.text+0x118):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x11d):curse.c: undefined reference to `wmove'
/tmp/ccwBoMEh.o(.text+0x130):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x135):curse.c: undefined reference to `waddch'
/tmp/ccwBoMEh.o(.text+0x1a4):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x1a9):curse.c: undefined reference to `wmove'
/tmp/ccwBoMEh.o(.text+0x1c0):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x1c5):curse.c: undefined reference to `waddch'
/tmp/ccwBoMEh.o(.text+0x1d8): In function `initial':
curse.c: undefined reference to `initscr'
/tmp/ccwBoMEh.o(.text+0x1dd):curse.c: undefined reference to `cbreak'
/tmp/ccwBoMEh.o(.text+0x1e2):curse.c: undefined reference to `nonl'
/tmp/ccwBoMEh.o(.text+0x1e7):curse.c: undefined reference to `noecho'
/tmp/ccwBoMEh.o(.text+0x1f2):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x1f7):curse.c: undefined reference to `intrflush'
/tmp/ccwBoMEh.o(.text+0x205):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x20a):curse.c: undefined reference to `keypad'
/tmp/ccwBoMEh.o(.text+0x216):curse.c: undefined reference to `stdscr'
/tmp/ccwBoMEh.o(.text+0x21b):curse.c: undefined reference to `wrefresh'
collect2: ld returned 1 exit status
发表于 2006-4-4 00:19:58 | 显示全部楼层
编译时加上 -lcurse 试试?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-4 12:25:29 | 显示全部楼层
linux:~/cc # gcc curse.c -lcurse
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: cannot find -lcurse
collect2: ld returned 1 exit status
出现这个问题了?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-4 12:25:40 | 显示全部楼层
linux:~/cc # gcc curse.c -lcurse
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: cannot find -lcurse
collect2: ld returned 1 exit status
出现这个问题了?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-4 12:27:01 | 显示全部楼层
linux:~/cc # gcc curse.c -lcurse
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: cannot find -lcurse
collect2: ld returned 1 exit status
???
回复 支持 反对

使用道具 举报

发表于 2006-4-5 04:24:20 | 显示全部楼层
老大,这个问题也来问(要养成独立思考的好习惯哦),原因就是你的系统里没有libcurse.so, libcurse.a一类的库文件呗,或者它们不在标准目录下,你要加上-lcurses,上面的兄弟笔误了,是-lcurses不是-lcurse,看出区别了? 要加多一个s,如果还是不行,说明没有libcurses.so或libcurses.a(几乎不可能),改成-lncurses,如果还是不行,-L/path to your curses lib -lncurses。
这还不行? 出去溜达一圈,回来重装你的ncurses和devel包。
回复 支持 反对

使用道具 举报

发表于 2006-4-5 10:45:50 | 显示全部楼层
可以试试SDL或FrameBuffer。
对pixel进行操作,很灵活。
SDL很适合做小游戏。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-5 16:52:08 | 显示全部楼层
大哥我也是初学 linux编程阿,好多不懂,还是谢谢littlepig大哥的指点
呵呵
回复 支持 反对

使用道具 举报

发表于 2006-4-5 17:45:24 | 显示全部楼层
说句题外话,如果是其它版的,只要不是被人问烂了的问题,不管多简单,都会有兄弟热心回答。但是我认为在这个版,我缺省认为你是学cs,ce或者以此为业或打算以此为业的的,自己对自己要求自然要高些。勤于观察思考,勤于翻阅大量参考书籍比知识本身还要重要,不知道什么curses,shared memory,semaphore都不怕,可以学嘛,但是如果不爱观察思考就很麻烦喽。
每次我带问题去见我老板和师兄们之前都要先想很久,这些问题是不是的确我解决不了必须他们指点才行。想着查着,有时就不用问他们了。前两天发现MINIX不支持第二块sata硬盘,搞了几下,没结果就烦了,把师兄叫来,5分钟搞定,被他说了一通,暴寒,那些东西他都告诉过我的。
当然这些话不是针对你的,我看到这个版很多兄弟姐妹提的问题都完全可以经过自己琢磨搞定的(前几贴有一个拼写错误的程序,版主好意提醒了她的拼写,照我看,不告诉她,憋着她才好;) 偶有点极端)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-5 22:44:03 | 显示全部楼层
了解
大哥指点,小弟铭记于心
回复 支持 反对

使用道具 举报

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

本版积分规则

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