Link Error: glew

Hello,

IDE: code::blocks 10.05
compiler: gnu gcc

code:

#define GLEW_STATIC
#include <GL/glew.h>
#include <GL/freeglut.h>
#include <GL/glext.h>
#include <stdlib.h>
#include <iostream>

using namespace std;

enum VAO_IDs {Triangles,NumVAOs};
enum Buffer_IDs {ArrayBuffer, NumBuffers};
enum Attrib_IDs {vPosition=0};

GLuint VAOs[NumVAOs];
GLuint Buffers[NumBuffers];

const GLuint NumVertices = 6;

/* GLUT callback Handlers */

void resize(int width, int height)
{

}

void display(void)
{

}

void key(unsigned char key, int x, int y)
{

}

void mouse()
{

}

void idle(void)
{

}

void init(void)
{
glGenVertexArrays(NumVAOs,VAOs);
glBindVertexArray(VAOs[Triangles]);

// GLfloat vertices[NumVertices][2]={
// {-0.9,-0.9},{0.85,-0.9},{-0.9,0.85},{0.9,-0.85},{0.9,0.9},{-0.85,0.9}
// };
}
/* Program entry point */

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(640,480);
glutInitWindowPosition(0,0);
glutInitContextVersion(4,0);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutCreateWindow(“scientific”);

GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
cout &lt;&lt; glewGetErrorString(err);

}

init();

glutReshapeFunc(resize);
glutDisplayFunc(display);
glutKeyboardFunc(key);

glutIdleFunc(idle);

glutMainLoop();

return EXIT_SUCCESS;

}

Error:

C:…\main.cpp|48|undefined reference to __glewGenVertexArrays'| C:...\main.cpp|49|undefined reference to __glewBindVertexArray’|

please help

Check that you have included glew lib correctly

hello,

Project/Build options/Linker settings/Link libraries:

freeglut
opengl32
glu32
winmm
gdi32
…\Program Files\CodeBlocks\MinGW\lib\glew32.lib

please help!!!

hello,

i extend the link-list with:

…\Windows\System32\glew32.dll

and it compiles!!!

hello,

but when i start the programm i get a application crash!!!

help

…\Windows\System32\glew32.dll

This is not a library!

C:…\main.cpp|48|undefined reference to `__glewGenVertexArrays’|

Where is this message coming from -it look like a link error?

…\Program Files\CodeBlocks\MinGW\lib\glew32.lib

try using an absoulte path rather than a relative path

You can also try adding this before glewInit


glewExperimental = GL_TRUE;
GLenum err = glewInit();

see if this helps.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.