Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: troubles with getting opengl to work

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    Jun 2013
    Posts
    70

    troubles with getting opengl to work

    hi all. i am running gcc on mingw32 with the eclipse ide. im linked to the following libraries: glu32, freeglut32, opengl32, glew32. here is my code:

    Code :
    #include <GL/glew.h>
    #include <GL/glu.h>
    #include <GL/gl.h>
    #include <GL/freeglut.h>
    #include <stdio.h>
     
    void init();
     
    int main(int argc, char **argv) {
     
        glutInit(&argc, argv);
        glutInitWindowSize(640,480);
        glutInitWindowPosition(10,10);
        glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
     
        glutCreateWindow("Blah");
     
        if (glewInit()) {
           exit(1);
        }
     
        init();
        // if GLEW is found, the program will show a "dirty" window.
        // if not, the window will only be shown only for a split second.
     
        return 0;
     
    }
     
    void init()
    {
    	 GLuint prog = glCreateProgram();
     
    	    // This is the rendering vertex shader
    	    static const char vshader[] =
    	    		"#version 430 core"
    	    		"layout (location = 0) in vec4 vPosition;"
    	    		"void main()"
    	    		"{"
    	    		"	gl_Position = vPosition;"
    	    		"}";
     
    	    // Simple fragment shader
    	    static const char fshader[] =
    	    		"#version 430 core"
    	    		"out vec4 fcolor;"
    	    		"void main()"
    	    		"{"
    	    		"	fColor = vec4 (0.0, 0.0, 1.0, 1.0);"
    	    		"}";
     
    	    // Compile and link like normal
    	    vglAttachShaderSource(prog, GL_VERTEX_SHADER, vshader);
    	    vglAttachShaderSource(prog, GL_FRAGMENT_SHADER, fshader);
     
    	    glLinkProgram(prog);
    	    glUseProgram(prog);
    }

    im getting these errors:

    undefined reference to `_imp____glewCreateProgram' main.c /test line 32 C/C++ Problem

    undefined reference to `_imp____glewLinkProgram' main.c /test line 56 C/C++ Problem

    undefined reference to `_imp____glewUseProgram' main.c /test line 57 C/C++ Problem

    undefined reference to `vglAttachShaderSource' main.c /test line 53 C/C++ Problem

    undefined reference to `vglAttachShaderSource' main.c /test line 54 C/C++ Problem

    any idea on how to solve them?
    thanks.

    i now understand that vglAttachShaderSource is simply not a function, but what about the other 2?
    Last edited by sandbucket; 06-15-2013 at 08:48 AM. Reason: figured out something

  2. #2
    Intern Contributor
    Join Date
    Jun 2013
    Posts
    70
    i figured it out. i just had to recompile the glew source. YYYYYYYYYYYYYEEEEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSS SS!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •