PDA

View Full Version : Link error on glGenVertexArrays et glBindVertexArray



j_sb22
09-09-2015, 01:59 PM
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.



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 :


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 !

j_sb22
09-09-2015, 02:23 PM
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
#include <GL/glew.h>

GClements
09-09-2015, 03:33 PM
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.