title: Simple openGL program won't pass compile
body: <p>I'm trying to compile a very simple program in openGL:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;GL/glew.h&gt;
  #include &lt;GLFW/glfw3.h&gt;
  #include &lt;glm/glm.hpp&gt;
  
  using namespace glm;
  
  int main()
  {
      if( !glfwInit() )
      {
              fprintf( stderr, "Failed to initialize GLFW\n");
              return -1;
      }
  
      glfwWindowHint(GLFW_SAMPLES, 4); // 4x antialiasing
      glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // Use OpenGL 3.X
      glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); // Use openGL X.3
      glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);  
      glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 
  
      // Open a window and create OpenGL context
      GLFWwindow* window; // May be needed to make it global
      window = glfwCreateWindow(1024, 768, "Tutorial 01", NULL, NULL);
      if(window == NULL)
      {
              fprintf(stderr, "Failed to pen GLFW window. If you have Intel GPU they are not 3.3 compatible. Try the 2.1 version of the tutorial.\n");
              glfwTerminate();
              return -1;
      }
      glfwMakeContextCurrent(window); // Initialize GLEW
      glewExperimental=true; // Needed in core profile
      if(glewInit() != GLEW_OK)
      {
              fprintf(stderr, "Failed to initialize GLEW.\n");
              return -1;
      }
  }
  </code></pre>
  
  <p>However when i try to compile it with g++ i'm getting the following errors:</p>
  
  <pre><code>In function `main':
  playground.cpp:(.text+0x9): undefined reference to `glfwInit'
  playground.cpp:(.text+0x49): undefined reference to `glfwWindowHint'
  playground.cpp:(.text+0x58): undefined reference to `glfwWindowHint'
  playground.cpp:(.text+0x67): undefined reference to `glfwWindowHint'
  playground.cpp:(.text+0x76): undefined reference to `glfwWindowHint'
  playground.cpp:(.text+0x85): undefined reference to `glfwWindowHint'
  playground.cpp:(.text+0xa4): undefined reference to `glfwCreateWindow'
  playground.cpp:(.text+0xd2): undefined reference to `glfwTerminate'
  playground.cpp:(.text+0xe5): undefined reference to `glfwMakeContextCurrent'
  playground.cpp:(.text+0xeb): undefined reference to `glewExperimental'
  playground.cpp:(.text+0xf1): undefined reference to `glewInit'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I've found some posts to this specific problem and the solution seems to be to pass the required libraries as arguments to g++. However, when i do that, the problem still persists.</p>
  
  <p>This is how i compile the code:</p>
  
  <pre><code>g++ -lglfw3 -pthread -lGLEW -lGLU -lGL -lrt -lXrandr -lXxf86vm -lXi -lXinerama -lX11 -o openGLWindow openGLWindow.cpp
  </code></pre>
  
  <p>Any help would be appreciated...</p>