title: Opengl linux undefined reference to basic functions
body: <p>I wrote a program on Ubuntu 11.04 that uses freeglut. It worked fine. Then I got another computer and tried to run the program on a fresh install of Ubuntu 11.04. Doesn't work. So I installed</p>
  
  <p><code><code>sudo apt-get install freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu</code>1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev mesa-common-dev gcc</code></p>
  
  <p>and tried to run the program, which imports</p>
  
  <pre><code>
  
      #include &lt;GL/freeglut.h&gt;
      #include &lt;GL/gl.h&gt;
      #include &lt;GL/glu.h&gt;
  </code></pre>
  
  <p>using the command</p>
  
  <p><code>g++ -lGL -lGLU -lglut Driver.cpp -o a</code></p>
  
  <p>However the linker or whatever spits out like 200 errors of the form:</p>
  
  <pre><code>
  
      Driver.cpp:(.text+0x3c6b): undefined reference to `glutSolidSphere'
      Driver.cpp:(.text+0x3c75): undefined reference to `glEnable'
      Driver.cpp:(.text+0x3c9a): undefined reference to `glColor4f'
      Driver.cpp:(.text+0x3cb5): undefined reference to `glRotatef'
      Driver.cpp:(.text+0x3d02): undefined reference to `glutSolidSphere'
      Driver.cpp:(.text+0x3d07): undefined reference to `glutSwapBuffers'
  
  </code></pre>
  
  <p>What is the cause of the problem?</p>