title: C++: glfw3 on ubuntu undefined reference
body: <p>I'm trying to compile a program from <a href="http://www.glfw.org/docs/3.0/quick.html" rel="nofollow">this</a> tutorial.</p>
  
  <pre><code>#include &lt;GLFW/glfw3.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  
  static void error_callback(int error, const char* description)
  {
   fputs(description, stderr);
  }
  static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
  {
   if (key == GLFW_KEY_ESCAPE &amp;&amp; action == GLFW_PRESS)
   glfwSetWindowShouldClose(window, GL_TRUE);
  }
  int main(void)
  {
   GLFWwindow* window;
   glfwSetErrorCallback(error_callback);
   if (!glfwInit())
   exit(EXIT_FAILURE);
   window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); 
   if (!window)
   {
    glfwTerminate();
    exit(EXIT_FAILURE);
   }
   glfwMakeContextCurrent(window);
   glfwSetKeyCallback(window, key_callback);
   while (!glfwWindowShouldClose(window))
   {
    float ratio;
    int width, height;
    glfwGetFramebufferSize(window, &amp;width, &amp;height);
    ratio = width / (float) height;
    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
    glBegin(GL_TRIANGLES);
    glColor3f(1.f, 0.f, 0.f);
    glVertex3f(-0.6f, -0.4f, 0.f);
    glColor3f(0.f, 1.f, 0.f);
    glVertex3f(0.6f, -0.4f, 0.f);
    glColor3f(0.f, 0.f, 1.f);
    glVertex3f(0.f, 0.6f, 0.f);
    glEnd();
    glfwSwapBuffers(window);
    glfwPollEvents();
   }
   glfwDestroyWindow(window);
   glfwTerminate();
   exit(EXIT_SUCCESS);
   }
  </code></pre>
  
  <p>What I get when I try to compile this:</p>
  
  <pre><code>/usr/local/lib/libglfw3.a(x11_window.c.o): In function `_glfwPlatformCreateCursor':
  x11_window.c:(.text+0x2d91): undefined reference to `XcursorImageCreate' 
  x11_window.c:(.text+0x2e61): undefined reference to `XcursorImageLoadCursor'
  x11_window.c:(.text+0x2e75): undefined reference to `XcursorImageDestroy'
  </code></pre>
  
  <p>I use this command</p>
  
  <pre><code>g++ glfw.o -lglfw3 -lGL -lGLU -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lm -lalleg
  </code></pre>
  
  <p>Running on Ubuntu 13.10</p>
  
  <p>I looked everywhere, installed box2d, glfw, glfw3, allegro, and some more libs - the reason is that I went through every discussion that remotely mentions glfw and undefined references, and in my frustration caused by five hours of stalemate, installed any library that was mentioned. The result remains the same. I don't know where to go from here. Any ideas what causes this please?
  Thank you.</p>