Hi all,
For some reason if I try to compile a simple terminal program in c++ with ncurses in Opensuse 12.2, I keep getting errors?
I am using the command line:
g++ -g -Wall -lncurses ncurses.cpp -o ncurses
Here are the ncurses packages I have installed (found with rpm -qa > pkglist):
yast2-ncurses-pkg-2.22.7-2.1.2.i586
libncurses5-5.9-12.5.1.i586
ncurses-utils-5.9-12.5.1.i586
ncurses-devel-5.9-12.5.1.i586
libncurses6-5.9-12.5.1.i586
yast2-ncurses-2.22.4-1.1.2.i586
Here is the small program I want to compile as a test of ncurses working:
#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;
}
Here are the errors:
/usr/lib/gcc/i586-suse-linux/4.7/…/…/…/…/i586-suse-linux/bin/ld: /lib/libncurses.so.5: undefined reference to symbol ‘stdscr’
/usr/lib/gcc/i586-suse-linux/4.7/…/…/…/…/i586-suse-linux/bin/ld: note: ‘stdscr’ is defined in DSO /usr/lib/gcc/i586-suse-linux/4.7/…/…/…/libtinfo.so so try adding it to the linker command line
/usr/lib/gcc/i586-suse-linux/4.7/…/…/…/libtinfo.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
Any ideas, this stuff normally just works? Thanks for any help.