[comp.unix.questions] how is tgetent defined?

david@wubios.wustl.edu (David J. Camp) (10/24/89)

I just extracted the curses-clock.shar archive from comp.unix.questions,
and it gave me an error that certain symboks were undefined, as below.
Fine, I said, I will just use -ltermcap or -lcurses, but neither worked.
Can anyone tell me in what library these symbols are defined?  I am
using a Sun 3/260 running SunOS 4.0.3.  Thank you,  -David-

cc -ltermcap -o gdc -O gdc.c -lcurses
ld: Undefined symbol 
   _tgetent 
   _tgetflag 
   _tgetstr 
   _tputs 
   _tgetnum 
   _tgoto 
*** Error code 1
make: Fatal error: Command failed for target `gdc'

Bitnet:   david@wubios.wustl                ^      Mr. David J. Camp
Internet: david%wubios@wucs1.wustl.edu    < * >    Box 8067, Biostatistics
uucp:     uunet!wucs1!wubios!david          v      660 South Euclid
Washington University (314) 36-23635               Saint Louis, MO 63110
-- 
Bitnet:   david@wubios.wustl                ^      Mr. David J. Camp
Internet: david%wubios@wucs1.wustl.edu    < * >    Box 8067, Biostatistics
uucp:     uunet!wucs1!wubios!david          v      660 South Euclid
Washington University (314) 36-23635               Saint Louis, MO 63110

ok@cs.mu.oz.au (Richard O'Keefe) (10/24/89)

In article <948@wubios.wustl.edu>, david@wubios.wustl.edu (David J. Camp) writes:
> cc -ltermcap -o gdc -O gdc.c -lcurses
     ^^^^^^^^^
Libraries should come *after* all the modules that use them.  Write
	cc -o gdc -O gdc.c -lcurses -ltermcap

madd@world.std.com (jim frost) (10/25/89)

In article <948@wubios.wustl.edu> david@wubios.UUCP (David J. Camp) writes:
|cc -ltermcap -o gdc -O gdc.c -lcurses
|ld: Undefined symbol 
|   _tgetent 
[etc]

Order of the libraries on the command line is important.  Use:

	cc -o gdc -O gdc.c -lcurses -ltermcap

jim frost
software tool & die
madd@std.com

gwyn@smoke.BRL.MIL (Doug Gwyn) (10/25/89)

In article <948@wubios.wustl.edu> david@wubios.UUCP (David J. Camp) writes:
>Fine, I said, I will just use -ltermcap or -lcurses, but neither worked.

Try -ltermlib.  By the way, -lwhatever is NOT a command line option;
it's shorthand for a library file name and thus should be placed after
the .o names.

paul@csnz.co.nz (Paul Gillingwater) (10/27/89)

In article <948@wubios.wustl.edu> david@wubios.UUCP (David J. Camp) writes:
>I just extracted the curses-clock.shar archive from comp.unix.questions,
>and it gave me an error that certain symboks were undefined, as below.
>cc -ltermcap -o gdc -O gdc.c -lcurses
>ld: Undefined symbol 
>   _tgetent >   _tgetflag >   _tgetstr >   _tputs >   _tgetnum >   _tgoto 

We ran into a similar problem recently.  There seems to be a trend for
vendors of UNIX to drop support for /etc/termcap, in favour of termlib.

If this is the case with your Sun, you might try using the terminfo
library anyway, since some of the termcap functions are emulated
using terminfo calls.  This support might be withdrawn in future too.

This wasn't a solution for us, because we extended the termcap we
use to add things like box drawing elements and other video attributes.
Finally, we found some Public Domain emulations of tgetent et.al.,
which I will be happy to share if there are enough requests.  I'd
rather not mail them, since we have to pay quite a bit for all mail coming
into and out of NZ.  The routines are from:
/*
 *	termcap.c	1.1	20/7/87		agc	Joypace Ltd
 *
 *	Copyright Joypace Ltd, London, UK, 1987. All rights reserved.
 *	This file may be freely distributed provided that this notice
 *	remains attached.
 *
 *	A public domain implementation of the termcap(3) routines.
 */
-- 
Paul Gillingwater, Computer Sciences of New Zealand Limited
Domain: paul@csnz.co.nz  Bang: uunet!vuwcomp!dsiramd!csnz!paul
Call Magic Tower BBS V21/23/22/22bis 24 hrs NZ+64 4 767 326
SpringBoard BBS for Greenies! V22/22bis/HST NZ+64 4 767 742