NCurses Assistance Needed

Aug 3, 2009 at 4:53am
Hello,

I am getting an undefined reference to "" for all NCurses items.
Let me give you my environment:
gcc
Code::Blocks
Ubuntu 9.04 (Jaunty)
NCurses 5.7 (Freshly Installed)

Here is an example of my problem:
1
2
3
4
5
6
7
8
9
10
11
12
#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;
}


I will get an error on initscr, printw, refresh, getch, endwin
undefined reference to initscr
undefined reference to printw
undefined reference to refresh
etc.etc.

When I Try:
find /usr/include -name ncurses.h
in my terminal it is found.

Maybe I need to use a certain namespace?

Thanks in advance for any help.
Last edited on Aug 3, 2009 at 4:57am
Aug 3, 2009 at 5:42am
You're not linking to the library.
That would be -lcurses.a or -lcurses.so for GCC.
Aug 3, 2009 at 10:11am
Is the ncurses library portable on both windows and linux machines?
Aug 3, 2009 at 11:25am
For windows are pdcurses, on others are ncurses.
If you just #include <curses.h> the same sourcecode should compile both for pdcurses and for ncurses
Aug 4, 2009 at 4:08pm
NCurses also has a dll file for windows, so mayabe, depending on your kernel type.
Aug 4, 2009 at 4:08pm
Thanks for the linking tip.
Topic archived. No new replies allowed.