title: undefined reference to functions in ncurses library
body: <p>I was trying to compile following code using ncurses library v 5.9. on Debian wheezy.
  But i am getting undefined refernce to the library fucntions.
  I installed the library from sources.</p>
  
  <pre><code>#include &lt;curses.h&gt;
  #include &lt;menu.h&gt;
  #include&lt;stdlib.h&gt;
  
  #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
  #define CTRLD   4
  
  char *choices[] = {
                      "Choice 1",
                      "Choice 2",
                      "Choice 3",
                      "Choice 4",
                      "Exit",
                };
  
  int main()
  {   ITEM **my_items;
  int c;              
  MENU *my_menu;
  int n_choices, i;
  ITEM *cur_item;
  
  
  initscr();
  cbreak();
  noecho();
  keypad(stdscr, TRUE);
  
  n_choices = ARRAY_SIZE(choices);
  my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));
  
  for(i = 0; i &lt; n_choices; ++i)
          my_items[i] = new_item(choices[i], choices[i]);
  my_items[n_choices] = (ITEM *)NULL;
  
  my_menu = new_menu((ITEM **)my_items);
  mvprintw(LINES - 2, 0, "F1 to Exit");
  post_menu(my_menu);
  refresh();
  
  while((c = getch()) != KEY_F(1))
  {   switch(c)
      {   case KEY_DOWN:
              menu_driver(my_menu, REQ_DOWN_ITEM);
              break;
          case KEY_UP:
              menu_driver(my_menu, REQ_UP_ITEM);
              break;
      }
  }   
  
  free_item(my_items[0]);
  free_item(my_items[1]);
  free_menu(my_menu);
  endwin();   
  }
  </code></pre>
  
  <p>Here is the error</p>
  
  <pre><code>root@sss:/home/sss/Desktop# gcc -Wall -o mn mn.c -lncurses -lmenu
  mn.c: In function ‘main’:
  mn.c:21:8: warning: unused variable ‘cur_item’ [-Wunused-variable]
  mn.c:58:1: warning: control reaches end of non-void function [-Wreturn-type]
  /usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/libmenu.a(m_driver.o): In function `menu_driver':
  m_driver.c:(.text+0x33b): undefined reference to `getmouse'
  m_driver.c:(.text+0x36c): undefined reference to `wenclose'
  m_driver.c:(.text+0x3b0): undefined reference to `wmouse_trafo'
  m_driver.c:(.text+0x7b9): undefined reference to `wenclose'
  m_driver.c:(.text+0x7f2): undefined reference to `wmouse_trafo'
  /usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/libmenu.a(m_global.o): In function `_nc_Show_Menu':
  m_global.c:(.text+0x78b): undefined reference to `copywin'
  /usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/libmenu.a(m_post.o): In function `_nc_Post_Item':
  m_post.c:(.text+0x3c): undefined reference to `wattr_on'
  m_post.c:(.text+0x8e): undefined reference to `wattr_off'
  m_post.c:(.text+0xce): undefined reference to `wattr_on'
  m_post.c:(.text+0x276): undefined reference to `wattr_on'
  m_post.c:(.text+0x3a3): undefined reference to `wattr_off'
  m_post.c:(.text+0x3db): undefined reference to `wattr_off'
  m_post.c:(.text+0x424): undefined reference to `wattr_on'
  m_post.c:(.text+0x458): undefined reference to `wattr_on'
  m_post.c:(.text+0x47e): undefined reference to `wattr_on'
  m_post.c:(.text+0x4ce): undefined reference to `wattr_on'
  m_post.c:(.text+0x4fe): undefined reference to `wattr_off'
  m_post.c:(.text+0x51e): undefined reference to `wattr_off'
  m_post.c:(.text+0x53a): undefined reference to `wattr_off'
  m_post.c:(.text+0x5b6): undefined reference to `wattr_off'
  /usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/libmenu.a(m_post.o): In function `_nc_Draw_Menu':
  m_post.c:(.text+0x605): undefined reference to `wbkgdset'
  m_post.c:(.text+0x61f): undefined reference to `wbkgdset'
  m_post.c:(.text+0x69e): undefined reference to `wattr_on'
  m_post.c:(.text+0x774): undefined reference to `wattr_off'
  /usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/libmenu.a(m_post.o): In function `unpost_menu':
  m_post.c:(.text+0xa41): undefined reference to `delwin'
  m_post.c:(.text+0xa53): undefined reference to `delwin'
  collect2: error: ld returned 1 exit status
  </code></pre>