[comp.unix.xenix] curses help needed

davek@lakesys.UUCP (Dave Kraft) (04/23/89)

Hi,
I recently purchased "Unix System V/386 Programmer's Guide", and in the chapter
on curses, I came upon the program below.  I am using SCO Xenix version 2.3,
release 1.  The program is as follows:

/* Example, page 10-33, "Unix System V/386 Programmer's Guide" */

#include <curses.h>

main()
{
	int ch;

	initscr();
	cbreak();
	addstr("Press any character:  ");
	refresh();
	ch = getch();
	printw("\n\n\nThe character entered was a '%c'.\n",ch);
	refresh();
	endwin();
}

Now, when compiled with the following
	cc cursestst.c -lcurses
I get the following message:

LINK:  unresolved externals:

_nap in file(s):
	/lib/386/Slibcurses.a(gettch.c)

Now, I thought maybe it was due to Unix/Xenix cross-programming, so, I checked
my man page on the curses getch(), and it mached with what the book said (on 
page 10-32), so, I am not sure what is causing this problem.  I am trying to
write windows-type software for a local company.

Any help would be appriciated.  Thanks in advance.

Dave

-- 
davek@lakesys.lakesys.com -OR- uunet!marque!lakesys!davek
-------------------------------------------------------------------------------
"The mystical divinity of unashamed felinity.  'Round the cathedral rang
'Vivat!'  Life to the everlasting Cat!" --'Cats'

davek@lakesys.UUCP (Dave Kraft) (04/23/89)

Oh, I also tried getstr(str), and I got the same link error.

Dave


-- 
davek@lakesys.lakesys.com -OR- uunet!marque!lakesys!davek
-------------------------------------------------------------------------------
"The mystical divinity of unashamed felinity.  'Round the cathedral rang
'Vivat!'  Life to the everlasting Cat!" --'Cats'

davek@lakesys.UUCP (Dave Kraft) (04/23/89)

Well, sorry to waste the bandwidth, but, I solved my own problem.  In re-reading

g the curses man pages, I found out that I needed to and two other libraries. 
Now, when I compile with:
	cc filename -ltcap -ltermlib [-lcurses] [-o filename]
everything works fine.

Dave

-- 
davek@lakesys.lakesys.com -OR- uunet!marque!lakesys!davek
-------------------------------------------------------------------------------
"The mystical divinity of unashamed felinity.  'Round the cathedral rang
'Vivat!'  Life to the everlasting Cat!" --'Cats'

jbayer@ispi.UUCP (Jonathan Bayer) (04/23/89)

In article <569@lakesys.UUCP> davek@lakesys.UUCP (Dave Kraft) writes:

>LINK:  unresolved externals:
>
>_nap in file(s):
>	/lib/386/Slibcurses.a(gettch.c)
>
>Now, I thought maybe it was due to Unix/Xenix cross-programming, so, I checked
>my man page on the curses getch(), and it mached with what the book said (on 

nap() has to be linked in using the compile flag "-lx" on Xenix.  It has
nothing to do with getch(), except that getch() calls nap().


JB

-- 
Jonathan Bayer			      Beware: The light at the end of the
Intelligent Software Products, Inc.	      tunnel may be an oncoming dragon
19 Virginia Ave.				...uunet!ispi!jbayer
Rockville Centre, NY 11570  (516) 766-2867    jbayer@ispi.UUCP

daveh@marob.MASA.COM (Dave Hammond) (04/25/89)

In article <569@lakesys.UUCP> davek@lakesys.UUCP (Dave Kraft) writes:
>[...] when compiled with the following
>	cc cursestst.c -lcurses
>I get the following message:
>
>LINK:  unresolved externals:
>
>_nap in file(s):
>	/lib/386/Slibcurses.a(gettch.c)
>

Try:
	cc cursestst.c -lcurses -lx

The nap() syscall is in the Xenix `x' library.  This is undocumented,
so far as Curses is concerned (yes, nap() is documented, but not as
relates to Curses).

--
Dave Hammond
daveh@marob.masa.com