自己写了一个小程序,练习终端编程:
#include<stdio.h>
#include<term.h>
#include<curses.h>
int main()
{
int nrows, ncols;
setupterm((char *)0, 1, (int *)0);
nrows = tigetnum("lines");
ncols = tigetnum("cols");
printf("This terminal has %d cols and %d rows\n", ncols, nrows);
exit(0);
}
编译时出现如下错误:
sizeterm.c:(.text+0x29): undefined reference to `setupterm'
sizeterm.c:(.text+0x35): undefined reference to `tigetnum'
sizeterm.c:(.text+0x44): undefined reference to `tigetnum'
我查看库里已经安装了libncurses,为什么连接时会出错?
ls -l libncurses*
-rw-r--r-- 1 root root 428524 2007-10-08 18:07 libncurses.a
-rw-r--r-- 1 root root 144292 2007-10-08 18:07 libncurses++.a
lrwxrwxrwx 1 root root 20 2008-06-26 17:51 libncurses.so -> /lib/libncurses.so.5
请教:终端编程连接出错的问题
-
- 帖子: 14
- 注册时间: 2007-06-03 15:29
- BigSnake.NET
- 帖子: 12522
- 注册时间: 2006-07-02 11:16
- 来自: 廣州
- 联系:
- liuqun67
- 帖子: 101
- 注册时间: 2008-05-29 22:53
- 来自: 青岛/南京
- 联系: