Curses, foiled again.

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Buettner
Date:  
Subject: Curses, foiled again.
On May 4, 8:09pm, foodog wrote:

> I'm trying to port a program written in VAX C circa 1988 that uses
> Curses library calls. When I try to build it I get a bunch of errors,
> specifically:
>
> [steve@gemini steve]$ cc bedit.c
> /tmp/ccNUfExw.o: In function `main':
> /tmp/ccNUfExw.o(.text+0x14e): undefined reference to `initscr'
> /tmp/ccNUfExw.o(.text+0x172): undefined reference to `newwin'
> /tmp/ccNUfExw.o(.text+0x1d2): undefined reference to `endwin'
> /tmp/ccNUfExw.o: In function `edit_buffer':
> /tmp/ccNUfExw.o(.text+0x369): undefined reference to `wprintw'
> /tmp/ccNUfExw.o(.text+0x39d): undefined reference to `wmove'
> /tmp/ccNUfExw.o: In function `first_screen':
> /tmp/ccNUfExw.o(.text+0x414): undefined reference to `wrefresh'
> /tmp/ccNUfExw.o: In function `key_not_supported':
> /tmp/ccNUfExw.o(.text+0x5b4): undefined reference to `werase'
> ... etc. etc. etc.
> collect2: ld returned 1 exit status
>
> I'm including stdio.h and curses.h. The functions are listed in
> curses.h so I'm hoping there's some compiler switch I'm missing out on.


You are linking it with the curses library, aren't you? (I.e, put
-lcurses on your link line. If that doesn't work, try -lncurses.)

FWIW, on one of my Red Hat 7.2 systems, I see:

$ objdump -T /usr/lib/libcurses.so | grep initscr
00014ad4 g    DF .text  000000c2  Base        initscr
$ objdump -T /usr/lib/libcurses.so | grep newwin
00017b30 g    DF .text  0000013b  Base        newwin
$ objdump -T /usr/lib/libcurses.so | grep endwin
00011f94 g    DF .text  00000050  Base        endwin
00014ea4 g    DF .text  00000029  Base        isendwin


So the symbols are there... (Or at least they are on my system.)

Kevin