title: undefined reference to functions in libncurses
body: <p>When I compile this code, I get the following gcc errors:</p>
  
  <pre><code>/tmp/ccUigsI6.o: In function `main':
  /home/matt/Dropbox/school/2011/cs3210/test/sizeterm.c:9: undefined reference to `setupterm'
  /home/matt/Dropbox/school/2011/cs3210/test/sizeterm.c:10: undefined reference to `tigetnum'
  /home/matt/Dropbox/school/2011/cs3210/test/sizeterm.c:11: undefined reference to `tigetnum'
  collect2: ld returned 1 exit status
  make: *** [sizeterm] Error 1
  </code></pre>
  
  <p>Here's the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;term.h&gt;
  #include &lt;curses.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
      int nrows, ncolumns;
      setupterm(NULL, fileno(stdout), (int *)0);
      nrows = tigetnum("lines");
      ncolumns = tigetnum("cols");
      printf("This terminal has %d columns and %d rows\n", ncolumns, nrows);
      exit(0);
  }
  </code></pre>
  
  <p>Libncurses is installed correctly on my machine.  I get the same results from my Arch linux laptop, and the Ubuntu server installed at my school.  This particular piece of code is taken directly out of the book.  Am I doing something wrong?  I've done some googling and it looks as though people have had this problem before, but I can't narrow down a solution.</p>