readline AWOL?

Jorge Almeida jjalmeida at gmail.com
Tue Nov 18 08:04:35 PST 2008


On Tue, 18 Nov 2008, Roger Oberholtzer wrote:

> On Mon, 2008-11-17 at 20:40 +0000, Jorge Almeida wrote:
>>  	$ gcc readtest.c
>>  	/tmp/cc88uLvp.o: In function `main':
>>  	readtest.c:(.text+0x19): undefined reference to `readline'
>>  	collect2: ld returned 1 exit status
>>  	$ ls /usr/include/readline
>>  	chardefs.h  history.h  keymaps.h  readline.h  rlconf.h  rlstdc.h  rltypedefs.h  tilde.h
>
> It is not complaining about the C definition in the various include
> files. It is complaining that it cannot find readline() when linking.
> Try this compile command:
>
> 	gcc readtest.c -lreadline -lhistory
>
Ah, so that's it. I thought the -l options were needed only for stuff in
nonstandard locations.
There are still problems that were not expected with such a simple
program:
 	$ gcc readtest.c -lreadline -lhistory
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetnum'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgoto'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetflag'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `BC'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tputs'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `PC'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetent'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `UP'
 	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetstr'
 	collect2: ld returned 1 exit status

This happens in FC5 but not in Gentoo. I suppose the former (which I
don't control) may have some problem. Back to learning readline, now.

Thanks.

Jorge



More information about the Linux-users mailing list