Yet another clear screen thread :D [Archive] - C Board

PDA

View Full Version : Yet another clear screen thread :D


kermit
11-19-2003, 06:12 PM
I am working on a program, and I wanted to clear the screen - (yes I read the faq, and yes I searched the boards) - I have come up with a suitable method of clearing the screen (I don't need it to be portable, as the program is strictly for my own use). Anyway, I tried using Hammer's solution from the faq:


#include <curses.h>

void clrscr(void)
{
static int init;

if (init == 0)
{
initscr();
init = 1;
}

clear();
refresh();
}


But the compiler (gcc) fed me this:


/tmp/ccSsrP07.o: In function `clrscr':
87: undefined reference to `initscr'
91: undefined reference to `stdscr'
91: undefined reference to `wclear'
92: undefined reference to `stdscr'
92: undefined reference to `wrefresh'
collect2: ld returned 1 exit status


So then I read about the clear() function (?) as well as werase() and so from the man pages, and thought that they looked like my solution, but I got this when I used clear():


/tmp/ccy5cjO5.o: In function `primary_menu':
53: undefined reference to `stdscr'
53: undefined reference to `wclear'
collect2: ld returned 1 exit status


I don't suppose somebody could explain all of this to me, as to why the two functions I tried would not work?

~/

lithium
11-19-2003, 08:56 PM
i havent done curses but:

gcc -o test test.c -lcurses

should work. that tells the compiler to link in the curses library (if it's installed)

kermit
11-20-2003, 05:14 AM
that was quite helpful actually. Thanks.