title: Undefined references using GLUT
body: <p>I have been using SDL with success to learn OpenGL, however I am following tutorials that are using GLUT and I attempted to switch over to GLUT because it looks easier to use for novices and I feel I would pick the content up quicker. I thought this would be a simple quick and painless process, however I am running into the following problem when attempting to compile GLUT content (using MinGW)
  (I've downloaded GLUT and extracted the header file to my includes so it is being included correctly, and I have also extracted the lib files to the lib folder and I'm linking against it, the .DLL for glut is present in my system32 so it is being called successfully. </p>
  
  <p>I'm clueless as to what I am doing wrong and would be grateful for any help and suggestions </p>
  
  <p>Build messages when compiling the following small piece of content (which won't do anything at the moment but should compile):</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;GL/glut.h&gt;
  
  static int day = 0, year = 0;
  
  void init()
  
  {
  
  glClearColor(0.0,0.0,0.0,0.0);
  glShadeModel(GL_FLAT);
  
  }
  
  void display(void)
  
  {
  
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0,1.0,1.0);
  
  glPushMatrix();
  glutWireSphere(1.0,20,16);
  glRotatef((GLfloat) year, 0.0,1.0,0.0);
  glTranslatef(2.0,0.0,0.0);
  glRotatef((GLfloat) day, 0.0, 1.0, 0.0);
  glutWireSphere(0.2,10,8);
  glPopMatrix();
  glutSwapBuffers();
  
  }
  
  //void reshape(int w, int h)
  
  int main(int argc, char **argv)
  
  {
  
  
  
  }
  </code></pre>
  
  <p>Builder Errors:</p>
  
  <pre><code>C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to    `__glutInitWithExit'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `__glutCreateWindowWithExit'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `__glutCreateMenuWithExit'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glClearColor'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glShadeModel'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glClear'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glColor3f'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glPushMatrix'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `glutWireSphere'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glRotatef'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glTranslatef'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glRotatef'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `glutWireSphere'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glPopMatrix'|
  C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `glutSwapBuffers'|
  ||=== Build finished: 15 errors, 0 warnings ===|
  </code></pre>