readline AWOL?

Roger Oberholtzer roger at opq.se
Tue Nov 18 01:19:40 PST 2008


On Mon, 2008-11-17 at 20:40 +0000, Jorge Almeida wrote:
> Hello, C-wise people,
> 
> Can someone understand this?
> 
>  	$ cat readtest.c
>  	#include <stdio.h>
>  	#include <readline/history.h>
>  	#include <readline/readline.h>
>  	#define MAINPROMPT ">"
>  	int main(int argc, char *argv[])
>  	{
>  	                char *lp;
>  	                lp=readline(MAINPROMPT);
>  	                return 0;
>  	}
>  	$ 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

Perhaps that helps?

-- 
Roger Oberholtzer

OPQ Systems / Ramböll RST

Ramböll Sverige AB
Krukmakargatan 21
P.O. Box 17009
SE-104 62 Stockholm, Sweden

Office: Int +46 8-615 60 20
Mobile: Int +46 70-815 1696

--

"On two occasions I have been asked (by members of Parliament!),
'Pray, Mr. Babbage, if you put into the machine wrong figures,
will the right answers come out?' I am not able rightly to apprehend
the kind of confusion of ideas that could provoke such a question.
  - Charles Babbage 1791-1871)
    English computer pioneer, philosopher

And remember:

It is RSofT and there is always something under construction. 
It is like talking about large city with all constructions finished. 
Not impossible, but very unlikely.




More information about the Linux-users mailing list