[plug] Trying to use Curses.h

David Buddrige buddrige at q-net.net.au
Sun Mar 7 18:31:20 WST 1999


Hi all...


I'm trying to use ncurses in a program.  In order to figure it out, I am
writing a test program.  However I am not able to figure it out - it
keeps bringing up an error - "undefined reference to newterm"... (see my
C++ below)...

could anyone point me towards some sample ncurses code on the net?  or
have I forgotten something silly?  BTW, it compiles ok with the g++
testcurses.c -c option, but when I do, g++ testcurses.c -o test it
brings up the error message I have described - seems to be a linking
problem, but not sure how to fix...

Any howto's on the net u could reference would be appreciated - have
found the man pages and a howto called

Writing Programs with NCURSES   by Eric S. Raymond and Zeyd M.
Ben-Halim. but have had no luck with these.  8-(

Thanks heaps guys for anything u can suggest... 8-)


regards

David Buddrige.

//
// Programmer: David Buddrige
// Date      : 6/3/1999
// Purpose   : To test the facilities provided by
//             the curses library.
//

#include </usr/include/ncurses/ncurses.h>

//#include <ncurses.h>
//#include <screens.h>

#define ARRAYSIZE 2

void initmyscreens(SCREEN *myscreen,
                   FILE *InputFile,
                   FILE *OutputFile) {

  //mywin = ;
  //initscr;
  //use_env(TRUE);
  myscreen = newterm("linux",
                     OutputFile,
                     InputFile);
}

void cleanupmyscreens(SCREEN *myscreen) {
  // This function closes of the curses library, and releases
  // any memory that has been obtained.

  endwin;
}


int main(void) {
  //WINDOW thewinarray[ARRAYSIZE];
  SCREEN *thescreenarray;
  int thekey;
  FILE *inputfile;
  FILE *outputfile;

  initmyscreens(thescreenarray,
                inputfile,
                outputfile);
  //box(,"|","-");

  //thekey = wgetch(thescreenarray);


  cleanupmyscreens(thescreenarray);
}



More information about the plug mailing list