readline problem [libreadline.so: undefined reference to...]

  • Permalink
  • submit to reddit
  • Email
  • Follow


I'm running RedHat 7.1 and I can't get the readline author's example program
to compile (nor any other readline-using program).  Any suggestions?  Here
are the error messages:

[root@db:/home/jake/weber/unix/readline-example]$ gcc -lreadline rl.c
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `tgetnum'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `tgoto'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `tgetflag'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `BC'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `tputs'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `PC'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `tgetent'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `UP'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
reference to `tgetstr'
collect2: ld returned 1 exit status


0
Reply Jason 7/13/2003 11:30:16 PM

See related articles to this posting


"Jason" <jake1138@NO.SPAM.yahoo.com> writes:

> I'm running RedHat 7.1 and I can't get the readline author's example program
> to compile (nor any other readline-using program).  Any suggestions?  Here
> are the error messages:
> 
> [root@db:/home/jake/weber/unix/readline-example]$ gcc -lreadline rl.c
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `tgetnum'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `tgoto'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `tgetflag'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `BC'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `tputs'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `PC'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `tgetent'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `UP'
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
> reference to `tgetstr'
> collect2: ld returned 1 exit status

RTFM.           gcc -lreadline -termcap rl.c

-- 
Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html
Dept. of Physics, Univ. of Padova, Italy              ROT13: ybergv@cq.vasa.vg
0
Reply Maurizio 7/14/2003 5:38:53 AM

Maurizio Loreti <mlo@foobar.it> wrote in message news:<rmy8z1u0pe.fsf@mlinux.pd.infn.it>...

> gcc -lreadline -termcap rl.c

Better make that "gcc rl.c -lreadline -ltermcap".
The order of sources and libraries matters, and so does spelling.

Cheers,
0
Reply ppluzhnikov 7/14/2003 8:53:24 PM

"Maurizio Loreti" <mlo@foobar.it> wrote in message
news:rmy8z1u0pe.fsf@mlinux.pd.infn.it...
> "Jason" <jake1138@NO.SPAM.yahoo.com> writes:
>
> > I'm running RedHat 7.1 and I can't get the readline author's example
program
> > to compile (nor any other readline-using program).  Any suggestions?
Here
> > are the error messages:
> >
> > [root@db:/home/jake/weber/unix/readline-example]$ gcc -lreadline rl.c
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `tgetnum'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `tgoto'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `tgetflag'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `BC'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `tputs'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `PC'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `tgetent'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `UP'
> > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
undefined
> > reference to `tgetstr'
> > collect2: ld returned 1 exit status
>
> RTFM.           gcc -lreadline -termcap rl.c
>
> -- 
> Maurizio Loreti
http://www.pd.infn.it/~loreti/mlo.html
> Dept. of Physics, Univ. of Padova, Italy              ROT13:
ybergv@cq.vasa.vg

And what FM would that be?

I can compile this just fine on a Debian system with just -lreadline, but
not on either of the RedHat systems that I've tried.  I can add -ltermcap
or -lncurses and either one will allow it to compile though.  Anyone care to
shed some light on why?  What does readline have to do with termcap or
ncurses?  By the way, thanks for your responses.

--
Jason
[ jake1138 AT yahoo DOT com ]


0
Reply Jason 7/15/2003 5:21:41 AM

"Jason" <jake1138@NO.SPAM.yahoo.com> wrote in message news:<bf0316$sk7$1@terabinaries.xmission.com>...

> And what FM would that be?

This doesn't appear to be documented in the info pages ;-(

You could have figured it out, though:

$ nm -AD /usr/lib/lib*.so 2>/dev/null | grep ' tgetnum'
/usr/lib/libcurses.so:00029140 T tgetnum
/usr/lib/libncurses.so:00029140 T tgetnum
/usr/lib/libreadline.so:         U tgetnum
/usr/lib/libtermcap.so:00001e60 T tgetnum

> I can compile this just fine on a Debian system with just -lreadline, but
> not on either of the RedHat systems that I've tried.  I can add -ltermcap
> or -lncurses and either one will allow it to compile though.  Anyone care to
> shed some light on why?  

Probably because libreadline.so on Debian has a dynamic dependency on
libtermcap.so or libncurses.so, while on RedHat it doesn't.

Run "ldd your_exe" to find which libreadline.so it uses, then 
"ldd /path/to/libreadline.so" on both systems, and compare the results.

> What does readline have to do with termcap or ncurses? 

It needs to redraw your screen (well, just the line on which you are typing),
and position your cursor. That's precisely what lib{curses,termcap} do.
Typing "info termcap" will tell you more.

Cheers,
0
Reply ppluzhnikov 7/15/2003 4:41:29 PM
comp.unix.programmer 10638 articles. 64 followers. Post

4 Replies
1706 Views

Similar Articles

[PageSpeed] 16


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Problem with undefined references
Hello all, I'm trying to use lcc-win32 (under Win 7) to compile a code I downloaded (that was developed on lcc-win32). Compilation results in "undefined reference" errors. Here is the output: Wedit output window build: Wed Nov 30 14:20:41 2011 tide2idx.obj: multiple definition of _main first definition is in file wxtidelcc.obj loclib.obj: multiple definition of _allocate_copy_string first definition is in file tide2idx.obj xprintf.obj: multiple definition of _printf first definition is in file wxtide.obj Error d:\ioannis\documents\wxtide32\wxt47_source\wxtide.c 3841 undefined...

strange undefined reference problem
Using MikTeX 2.8, via WinEdt 5.5. Have done so for many a year. Tried recompiling some chapters for one of my books, and noticed that all of the cross-references (figures, sections,. subsections) were coming up as ?? in the DVI file. So, I made a minimal example chapter (I build the book using a sekelton file with lots of 'includes for individual chapters). % set default indentation for >1st paragraph \parindent0.4cm \chapter{\sffamily This is the title} \vspace{-1.2cm} \noindent\textbf{Joe Smith}, \emph{Snooty University} %turn of page numbering for first pag...

Problem with make: undefined reference to vtable
Hi, I am using djgpp to compile a program that comprises several files. I added a new class 'TMyInfoDialog' to the program defined in 'infoDialog.cpp'. I am instantiating this class in another part of the program. When I make the program, it compiles fine. On linking, however it gives the following errors: ../infoDialog.o (text+0x5a): infoDialog.cpp : undefined reference to 'vtable for TMyInfoDialog' ../infoDialog.o (text+blah): infoDialog.cpp : undefined reference to 'VTT for TMyInfoDialog' Can anyone throw some light on this problem?? Regards, Ahmad Rizv...

Problem linking netcdf
Hi - since my Suse 10.1 didn't have netcdf support enabled by default, I downloaded the sources from http://www.unidata.ucar.edu/software/netcdf/ then did ../configure --prefix=/usr make make test --> succeeded make extra_test --> succeeded make install In my /usr/include I now have the files netcdfcpp.h netcdf.h netcdf.hh and in /usr/lib I have libnetcdf.a libnetcdf_c++.a And while now my program using netcdf compiles fine, the linker will complain about undefined references - I tried compiling with g++ -o test test.cpp g++ -o test test.cpp -lnetcdf g++ -o test test.cpp -ln...

static library + undefined reference problem
Hi, I'm working on a static library which compiles OK, but when I link it to the program I receive several errors from compiler indicating errors from static lib. Compiles OK: lcc ebicom.c -ansic -unused -g5 lcclib /out:ebicom.lib ebicom.obj oleaut32.lib ole32.lib uuid.lib small app linked with ebicom.lib output: ebicom.obj .text: undefined reference to '_CoTaskMemAlloc@4' ebicom.obj .text: undefined reference to '_CoTaskMemFree@4' ebicom.obj .text: undefined reference to '_CLSIDFromProgID@8' ebicom.obj .text: undefined reference to '_IID_IUnknown' ebic...

problem with undefined reference to `__gxx_personality_v0'
I have a small program which when I complie it I recieve the following error: /root/tmp/cc633sc7.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status The program reads as below: #include <stdio.h> #include <curses.h> //---------------------------------------------------------------------------- int main(void) { char input; initscr(); do{ printf("enter a character\r"); input=getch(); printf("character recieved was %c\r",input); }while(input != '\n'); endwin(); ...

How to resolve "undefined reference to..." problems?
Scroll to the bottom and read the last part first. I've been trying very diligently to 'modularize' the code from TC++PL3E found here: http://www.research.att.com/~bs/matrix.c I keep getting what I believe are linker errors. For example: g++ -g -O2 -o rematrix cslice_iter.o main.o matrix.o rematrix.o slice_iter.o rematrix.o(.text+0x29b): In function `f(int, int)': /code/c++/stl/valarray/rematrix/src/rematrix.cpp:43: undefined reference to `Matrix::column(unsigned)' rematrix.o(.text+0x3a8):/code/c++/stl/valarray/rematrix/src/rematrix.cpp:51: undefined reference to ...

gfortran/g77 ld problem: undefined references
I have a copy of the FORTRAN77 random number generating library, ranlib.f I have compiled this code using g77 (gfortran gave me compilation errors, which surprised me as the library is well-established, widely-used code). When I try to link to the library created (libran.a) I get a whole pile of undefined reference errors. These follow at the bottom ofthis message. The routines that are undefined are not part of the random number generating package or the program that is being linked to it. I have hunted around on the web, and couldn't find anything helpful. Any suggestions appreciated....

'undefined reference to' compilation problem
Hi there, just wondering if anyone can help me on this since it's doing_my_head_in. Essentially, I'm trying to link code to subroutines of the HEALpix package, and also to lapack95. However, I keep getting 'undefined reference to <subroutine>. Apologies for the lengthiness of it, but I've written most of my procedure below (for the sake of detail): -------------------------------------------------------------------------------- Okay, so initially the code was simply like: PROGRAM TEST use pix_tools END PROGRAM which compiled like: frigga2:in jbowyer >...

compiling problem: undefined reference to `function_name'
hi all.. when i try to compile this program gcc return this list of 'errors'.. this is a piece of the source code.. <code> #include <GL/glut.h> void display(void){ glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glBegin(GL_POLYGON); glVertex3f(0.25, 0.25, 0.0); glVertex3f(0.75, 0.25, 0.0); glVertex3f(0.75, 0.75, 0.0); glVertex3f(0.25, 0.75, 0.0); glEnd(); ... </code> this the errors list <errors_list> /tmp/cc3aHpJh.o(.text+0xf): In function `display':...

Installation problem
Sorry to bother the group on what is probably an elementary question for you, but due to the latest security alerts I'm trying to install the latest sendmail on a 5-yr-old Linux system (Red Hat 6.2). Unlike the March alert, RH no longer has an RPM for this system, so I downloaded the source and tried to install. Here in the error and preceding lines: Configuration: pfx=, os=Linux, rel=2.4.3-20mdk, rbase=2, rroot=2.4, arch=i686, s fx=, variant=optimized Making in /usr/src/sendmail-8.12.10/obj.Linux.2.4.3-20mdk.i686/sendmail cc -o sendmail main.o alias.o arpadate.o bf.o collect.o conf.o c...

winsock/mingw compile problem (undefined reference)
I'm new to c++. Just started learning it 24 hours ago. Am running into a compile problem. Please, no one waste the effort telling me to google it. I've been researching it for quite a while with no joy. I got dev-c++ and a bit of winsock sample code. I've done nothing out of the ordinary. I could only assume that anyone else that downloaded this software and attempted this would meet with the same result. The problem lies with either the compiler or the source. I'm not sure which. Help greatly appreciated. Compiler output and source to follow. Compiler: Default compiler...

problem with LZO: undefined reference to '__lzo_init2'
Hi, I need help with LZO. I write a programm in C, with Linux (debian) and I need to use LZO for compress my data. I install LZO and in my code I add: #include <lzoconf.h> #include <lzo1x.h> and in my 'main': lzo_init(); The answer, when I compiling is: gcc MyProgram.c -o MyProgram /tmp/cc2Lx3eX.o: In function `main': MyProgram.c:(.text+0x19fc): undefined reference to `__lzo_init2' collect2: ld returned 1 exit status Someone can help me? I thank you in advance, Zanardi. Zanardi <gasperotti@supereva.it> writes: > Hi, > > I need help with LZO....

help on linking problem on linux undefined reference errors
Dear buddies: I need your urgent help! thanks first. I compiled matlab .m file into C++ code and try to compile these files and link to my own C++ codes. I got tons of link "undefined reference errors" like: freqresp.o(.text+0x48b5):/dragon/hu5/ec/beagle-1.0.1/gpbg/examples/gpb grobust/src/freqresp.cpp:346: undefined reference to `mwArray::operator=(mwArray const&)' freqresp.o(.text+0x48d1):/dragon/hu5/ec/beagle-1.0.1/gpbg/examples/gpb grobust/src/freqresp.cpp:346: undefined reference to `mwArray::~mwArray [in-charge]()' ltifr.o(.gnu.linkonce.t._ZN9MathWorks7reshapeERK...

linking problem: undefined reference to `D3DXCreateFontA@48'
Hi , i'm using devc++ , when compiling i get only this error message: [Linker error] undefined reference to `D3DXCreateFontA@48' i've linked in libd3d9.a and libd3dx9d.a (which removed a lot of undefined reference errors) on msdn it says that the import library for D3DXCreateFont is d3dx9.lib and the header file is d3dx9core.h( which i've included) how can i fix this? someone please help! i'm desperate to move on thanks in advance ...

undefined reference to `sqlcxt' (Pro C compilation problem)
Hi Greetings to all I am new to ProC. I am compiling a very simple program written in ProC. I can compile the program using proc filename.pc and it generates the corresponding c code :) , but when i try to compile the C program using cc -O3 -DPRECOMP -I. -I/opt/oracle/products/9.2.0/rdbms/public -I/opt/oracle/products/9.2.0/precomp/public -I/opt/oracle/products/9.2.0/rdbms/demo -I/opt/oracle/products/9.2.0/plsql/public -I/opt/oracle/products/9.2.0/network/public -DLINUX -D_GNU_SOURCE -D_GNU_SOURCE -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -L /opt/oracle/pro...

Problem with undefined references in a dialog subclass [Now correctly posted]
Hi there, I'm trying to build a test dialog from the tutorial(bzzt.net/~wxwindows/). Platform is Win XP with MinGW 3.3.1 and wxWidgets 2.5.2 in dev-cpp 4.9.9.0 I've pasted the sourcecode and the error message on paste.cgi, because it's a little too long for the mail I think. The URL is: http://wiki.wxwidgets.org/paste.cgi?id=614 Thanks in advance for help. Best Regards, Michael. P.S: Sorry for posting it wrong at first, one should learn the shortcut of his mail client. ;) --------------------------------------------------------------------- To unsubscrib...

DJPGG and Windows XP Professional + I think a Undefined Reference or linker problem
hello, - I have now pulled all my hair out after wasting another day messing around with no succuss. I was working though Steves Heller (excellent book) Learning to Program C++ which uses code provided and DJGPP compiler, contained on the CD. I have come back to this book after sometime and was setting the compiler up on my current Windows XP Professional PC. It worked a few years ago when I was running Win98 but not now. Anyway.... that was just background info..... I have installed and configured DJGPP according to all documentation the update version (v2.04) from the web site (the cd ...

Re: DJPGG and Windows XP Professional + I think a Undefined Reference or linker problem
sorry, should have been paying attention to the listing I have now tried gpp that compiles my prog. So what is the difference between gcc and gpp can I fine tune gcc to get to the bottom of my original problem cheers "wordsworth" <news@callera.net> wrote in message news:... > hello, - I have now pulled all my hair out after wasting another day messing > around with no succuss. > > I was working though Steves Heller (excellent book) Learning to Program C++ > which uses code provided and DJGPP compiler, contained on the CD. I have > come back to this book ...

MEX-Fortran on Win/mingw/gcc, problem: 'undefined reference ...'
HI, I'm trying to MEX an example case provided by ML: yprimef.f yprimefg.f I have MinGW's gcc on Win along with ML 6.5, the compilation is via gnumex. When I run: mex yprime.c the proces is smooth and the result is OK. In Fortran version, there are problems with unrecognised symbols/references, probably in terms of leading/trailing underscores. For the case of: mex yprimef.f yprimefg.f I get following error report: >> mex yprimef.F yprimefg.F `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. `-mcpu=' is deprecated. Use `-mtune=' or ...

Dev-cpp,win2k linking problems. Linker spamming "undefined reference to"
CHB Floyd IV wrote > In Dev-CPP->Project Options->Parameters->Linker > -mthreads -Wl,--subsystem,windows -mwindows -lwx_mswd_core-2.5 -lwx_based- 2.5 -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexd -lwxexpatd > -mthreads -lrpcrt4 -loleaut32 -lodbc32 -lole32 -luuid -lwinspool -lwinmm - lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 take care of the linking-order, the first wxlib has to be -lwx_based-2.5 take a look to http://www.wxwidgets.org/manuals/2.5.2/wx_librarieslist.html#librarieslist CHB Floyd IV wrote > I don't have a sing...

Problems compiling PHP5 -- ext/mysql/php_mysql.c:1120: undefined reference to `mysql_set_character_set'
Hi: When trying to compile PHP 5.2.6 I receive the error below when runing make. If I comment out the if/else block in php_mysql.c on line 1120 it compiles as expected. Also, it's worth noting that I was able to find mysql_character_set() in the mysql source and my PHP config flag is --with-mysql=/usr/local/mysql which that directory has mysql_character_set in /usr/local/mysql/include/mysql/mysql.h This is a solaris 10 box and I've tried a billion things. Some noteworthy are I compiled the latest gcc with gnu flags and points to gnu ld. Any suggestions are appreciated! make error: e...

reference to reference and constness problems with bind1st
T x; T foo(T, T); bind1st(ptr_fun(foo), x) creates a function object that takes an argument of type T const&. This does not work if T is already a reference type like int const&. So my first problem is with the &. My second problem is with the const. Why should bind1st change the constness of the second argument of the function´┐Ż? I am currently using boost::bind instead, but I would rather not depend on boost for all my programs... Marc wrote: > > T x; > T foo(T, T); > bind1st(ptr_fun(foo), x) > > creates a function object that takes an argu...

In the file, $TAO_ROOT/tao/Any_Insert_Policy_T.h:44: undefined reference to `operator<<=(CORBA::Any&, common::Common_I*)'. A few similar errors occured and all are undefined reference only.
TAO VERSION: 2.1.0 ACE VERSION: 6.1.0 HOST MACHINE and OPERATING SYSTEM: Ubuntu 12.04 =20 TARGET MACHINE and OPERATING SYSTEM, if different from HOST: Same as HO= ST. COMPILER NAME AND VERSION (AND PATCHLEVEL): gcc version 4.6.3 THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform- specific file, simply state which one]: #include "ace/config-linux.h" THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you use a link to a platform-specific file, simply state which one (unless this isn't used in ...