opengl glfw glew undefined reference

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Nyap, Jul 18, 2016.

  1. Nyap
    OP

    Nyap HTML Noob

    Banned
    973
    344
    Jan 13, 2016
    That Chaos Site
    so yeah I was really looking forward to learning opengl until I discovered its a fucking nightmare :wacko:
    here's the example code I'm trying to build
    Code:
    #include <GL/glew.h> // include GLEW and new version of GL on Windows
    #include <GLFW/glfw3.h> // GLFW helper library
    #include <stdio.h>
    
    int main () {
      // start GL context and O/S window using the GLFW helper library
      if (!glfwInit ()) {
      fprintf (stderr, "ERROR: could not start GLFW3\n");
      return 1;
      }
    
      // uncomment these lines if on Apple OS X
      /*glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 3);
      glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 2);
      glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
      glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);*/
    
      GLFWwindow* window = glfwCreateWindow (640, 480, "Hello Triangle", NULL, NULL);
      if (!window) {
      fprintf (stderr, "ERROR: could not open window with GLFW3\n");
      glfwTerminate();
      return 1;
      }
      glfwMakeContextCurrent (window);
    
      // start GLEW extension handler
      glewExperimental = GL_TRUE;
      glewInit ();
    
      // get version info
      const GLubyte* renderer = glGetString (GL_RENDERER); // get renderer string
      const GLubyte* version = glGetString (GL_VERSION); // version as a string
      printf ("Renderer: %s\n", renderer);
      printf ("OpenGL version supported %s\n", version);
    
      // tell GL to only draw onto a pixel if the shape is closer to the viewer
      glEnable (GL_DEPTH_TEST); // enable depth-testing
      glDepthFunc (GL_LESS); // depth-testing interprets a smaller value as "closer"
    
      /* OTHER STUFF GOES HERE NEXT */
    
      // close GL context and any other GLFW resources
      glfwTerminate();
      return 0;
    }
    and here's the command I'm using
    output:
    plz help
    edit: I just tried compiling the examples that come with GLFW using the included makefile and it works fine
     
    Last edited by Nyap, Jul 18, 2016
  2. Nyap
    OP

    Nyap HTML Noob

    Banned
    973
    344
    Jan 13, 2016
    That Chaos Site
    man pppppppplllllllllllzzzzzzz these demos are so cool why did I have to get stuck like right at the start
    [​IMG]