Bug 112687 - Can't compile a simple example using readline.
Summary: Can't compile a simple example using readline.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: readline
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-12-28 06:01 UTC by Need Real Name
Modified: 2007-04-18 17:00 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-12-29 19:36:19 UTC
Embargoed:


Attachments (Terms of Use)

Description Need Real Name 2003-12-28 06:01:23 UTC
Description of problem:

Failure to compile everytime readline is required.


Version-Release number of selected component (if applicable):

readline-4.3-5


How reproducible:

Completely reproducible in my pretty-much updated system.
The RPMs corresponding to most of the files usually required for
development (including readline and readline-devel) are installed.


Steps to Reproduce:

1.
Create a file with the name and content indicated by the next
step/item (i.e. 2.)

2.
$ cat tst-readline.c

#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
                                                                     
          
int main()
{
  char* prompt="PROMPT>";
                                                                     
          
  char*  linealeida;
                                                                     
          
  linealeida = readline(prompt);
                                                                     
          
  printf("\n%s\n", linealeida);
}
                                                                     
          
3.
$ gcc -lreadline tst-readline.c -o tst-readline

Actual results:

/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:    
  undefined reference to `tgetnum'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgoto'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgetflag'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `BC'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tputs'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `PC'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgetent'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `UP'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgetstr'
collect2: ld returned 1 exit status


Expected results:

(a succesfull compilation and the file tst-readline created)

Additional info:

I'm a readline newbie, and therefore I might be missing something. If
so, please say how a simple readline example should be compiled. BTW,
I guess the problem might be asociated to readline not being correctly
linked againste either curses(terminfo) or termcap.
Thanks.

Comment 1 Need Real Name 2003-12-29 19:36:19 UTC
Add "-ltermcap" to gcc's command line.


Note You need to log in before you can comment on or make changes to this bug.