LINUX readline 库的使用,,
编译代码时必须链接libreadline 与libtermcap
基只有前者,,将会有如下的链接失败
/usr/lib/libreadline.so: undefined reference to `tgetnum'
: /usr/lib/libreadline.so: undefined reference to `tgoto'
: /usr/lib/libreadline.so: undefined reference to `tgetflag'
: /usr/lib/libreadline.so: undefined reference to `BC'
: /usr/lib/libreadline.so: undefined reference to `tputs'
: /usr/lib/libreadline.so: undefined reference to `PC'
: /usr/lib/libreadline.so: undefined reference to `tgetent'
: /usr/lib/libreadline.so: undefined reference to `UP'
: /usr/lib/libreadline.so: undefined reference to `tgetstr'
Makeifle (eg):
read: read.o
gcc -o read read.o -I/usr/include -lreadline -ltermcap
read.o: read.c
gcc -c read.c -lreadline