title: OpenGL program keeps crashing?
body: <p>This code returns 3 errors (literally all the errors)
  <code>GLEW init failed; GLFW init failed; Window creation failed</code>:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include "GL/glew.h"
  #include "GLFW/glfw3.h"
  
  #include &lt;iostream&gt;
  
  
  //Window dimensions
  const GLint SCREEN_WIDTH = 800, SCREEN_HEIGHT = 600;
  
  
  int main() {
      //Initialize GLFW
      if (glfwInit() != GLEW_OK) { 
          std::cout &lt;&lt; "GLFW init failed\n"; 
          glfwTerminate(); 
      }
  
  
      //Setup GLFW window properties
      //OpenGL version
      glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); //Large version
      glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); //Small version 
      glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //Detects any old OpenGL code, this will throw an error
      glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); //Allows forward compatibility (between differnt OS) 
  
  
      //Creating window
      GLFWwindow* window; 
      window = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "OpenGL Test Window", NULL, NULL);
      if (window == NULL) {
          std::cout &lt;&lt; "GLFW window creation failed!\n";
          glfwTerminate();
      }
  
      //Get buffer size information
      int BUFFER_WIDTH, BUFFER_HEIGHT;
      glfwGetFramebufferSize(window, &amp;BUFFER_WIDTH, &amp;BUFFER_HEIGHT);
  
      //Set context for GLEW to use (can change between which window)
      glfwMakeContextCurrent(window);
  
      //Allow modern extension features
      glewExperimental = GL_TRUE;
  
  
      if (glfwInit() != GLEW_OK) {
          std::cout &lt;&lt; "Glew init failed!\n";
          glfwDestroyWindow(window);
          glfwTerminate();
      }
  
  
      //Setup viewport size
      glViewport(0, 0, BUFFER_WIDTH, BUFFER_HEIGHT);
  
  
  
      //Main game loop
      while (!glfwWindowShouldClose(window)) {
          //Get + Handle user input events
          glfwPollEvents();
  
          //Clear window
          glClearColor(1.f, 0.f, 0.f, 1.f);
          glClear(GL_COLOR_BUFFER_BIT);
  
          glfwSwapBuffers(window);
      }
  }
  </code></pre>