title: gcc /usr/bin/ld: error: cannot find -lncurses
body: <p>I am running Ubuntu 12.04 and I'm currently working on a project involving C, OpenGL, a teapot and input methods.</p>
  
  <p>The problem started when I decided to have arrow keys as input. I checked to see the key codes for arrow keys but all of the arrows return 0. I looked up how to get this to work and I found conio.h. Unfortunately, it is an old DOS header that is not available for Linux. Then I found a substitute called ncurses.</p>
  
  <p>After installing the necessary libraries, by following the build instructions closely, I #included curses.h in my main.c source. When I first tried to compile using gcc, I got the following errors:</p>
  
  <pre><code>main.o:main.c:function _Key: error: undefined reference to 'stdscr'
  main.o:main.c:function _Key: error: undefined reference to 'wgetch'
  main.o:main.c:function _Key: error: undefined reference to 'stdscr'
  main.o:main.c:function _Key: error: undefined reference to 'wgetch'
  </code></pre>
  
  <p>I found a fix by adding -lncurses to the makefile like so:</p>
  
  <pre><code>SOURCES=main.c
  
  main: main.o
      gcc -lm -lGL -lGLU -lglut -lncurses main.o -o main
  
  main.o: main.c
      gcc -lm -lGL -lGLU -lglut -c main.c
  </code></pre>
  
  <p>But I was greeted by another error:</p>
  
  <pre><code>/usr/bin/ld: error: cannot find -lncurses
  </code></pre>
  
  <p>As well as the previous errors.</p>
  
  <p>I have spent the last 2 days searching both the Ubuntu forums and StackOverFlow. Any help would be appreciated.</p>
  
  <p>P.S. I don't know if this is important but when I try to run /usr/bin/ld I get this error:</p>
  
  <pre><code>ld: fatal error: no input files
  </code></pre>