Yet another clear screen thread :D

This is a discussion on Yet another clear screen thread :D within the Linux Programming forums, part of the Platform Specific Boards category; I am working on a program, and I wanted to clear the screen - (yes I read the faq, and ...

  1. #1
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528

    Yet another clear screen thread :D

    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:

    Code:
    #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?

    ~/

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    88
    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)

  3. #3
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    that was quite helpful actually. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Clear Screen in C++ console
    By ay_okay in forum C++ Programming
    Replies: 9
    Last Post: 12-21-2004, 03:05 AM
  2. CLear Screen Routine
    By AQWst in forum C++ Programming
    Replies: 4
    Last Post: 12-13-2004, 07:24 PM
  3. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  4. Getting a clear screen...
    By Finchie_88 in forum C++ Programming
    Replies: 13
    Last Post: 09-03-2004, 05:38 PM
  5. Clear Screen Again!!!
    By trang in forum C Programming
    Replies: 3
    Last Post: 12-13-2003, 07:36 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21