Ncurses c++ compile problems??

Hi all,

Still trying to compile programs using ncurses and getting errors. I have two different versions of ncurses installed (according to rpm -qa | grep ncurses): libncurses5-5.9-12.5.1.i586 and libncurses6-5.9-12.5.1.i586 along with the version 5 devel package (ncurses-devel-5.9-12.5.1.i586)-don’t know why there are two versions installed?

I am using a standard command line to compile:

g++ -g -Wall -lncurses program.cpp -o program

and I am getting the following errors:

/lib/ undefined reference to symbol ‘stdscr’
note: ‘stdscr’ is defined in DSO /…/ so try adding it to the linker command line
/…/ could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

The c++ program is a simple ncurses ‘hello world’ program, don’t know why I am getting the errors?

#include <ncurses.h>

int main()
        initscr();                      // Start curses mode        
        printw("Hello World !!!");      // Print Hello World          
        refresh();                      // Print it on to the real screen
        getch();                        // Wait for user input
        endwin();                       // End curses mode

        return 0;

Thanks for any help.


You already started two (2) times a thread about this. And we put a lot of effort in merging them into the correct place. A place where the chance of getting help is optimal.

Why do you start a new thread again? This is in fact not double posting, but triple posting!

Please try to understand how these forums function. A question/problem should be asked in the the most promising (sub)forum because there people with knowledge are most likely to look for threads where they can help. And everybody then wants one and only one thread with the whole discussion about the subject. For now and for those that read the thread in the future. The thread should then have a logical sequence of posts and be consistent.

This thread is CLOSED. Those interested in the subject, please go to: