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 3 of 3

Thread: Link error on glGenVertexArrays et glBindVertexArray

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2015
    Posts
    12

    Link error on glGenVertexArrays et glBindVertexArray

    I'm learning OpenGL and i have issue with just a simple triangle...

    I get a link error with glGenVertexArrays et glBindVertexArray.

    When i delete these 2 lines, my program has no link error.

    I linked with freeglut, glew64, glew32, glew32s just in case. My program is configured as x64.

    Code :
    GLuint VertexArrayID;
    glGenVertexArrays(1, &VertexArrayID); // ERROR HERE
    glBindVertexArray(VertexArrayID); // ERROR HERE
     
    static const GLfloat g_vertex_buffer_data[] = {
        -1.0f, -1.0f, 0.0f,
        1.0f, -1.0f, 0.0f,
        0.0f, 1.0f, 0.0f,
    };
     
    GLuint vertexbuffer;
     
    glGenBuffers(1, &vertexbuffer);
     
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
     
    glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
     
    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glVertexAttribPointer(
        0,                  correspondre au « layout » dans le shader 
        3,                 
        GL_FLOAT,            
        GL_FALSE,    
        0,
        (void*)0 
        );
     
    glDrawArrays(GL_TRIANGLES, 0, 3); // Démarre à partir du sommet 0; 3 sommets au total -> 1 triangle 
     
    glDisableVertexAttribArray(0);

    Link errors :

    Code :
    error LNK2001: symbole externe non résolu __imp___glewGenVertexArrays
    error LNK2001: symbole externe non résolu __imp___glewBindVertexArrays

    I'm programming on VS 2013, my GC is a GTX 970 and my drivers are up to date.

    I tried on a sample of CUDA and is does the same thing.

    Thank you for your help !

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2015
    Posts
    12
    Ok, i set the preprocessor flash : GLEW_STATIC and now the others functions are shown as external symbol unresolved.

    In my depedencies i have : glew32s.lib and glew64.lib. Am I right ?

    I already included
    Code :
    #include <GL/glew.h>

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,463
    Quote Originally Posted by j_sb22 View Post
    Ok, i set the preprocessor flash : GLEW_STATIC and now the others functions are shown as external symbol unresolved.

    In my depedencies i have : glew32s.lib and glew64.lib. Am I right ?[/CODE]
    You should only link against one version of the GLEW library. Which one depends upon whether you're compiling a 32-bit or 64-bit executable, and whether you're linking statically.

Posting Permissions

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