PDA

View Full Version : Link Error: glew



nice87day
04-26-2013, 05:19 PM
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 << 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

tonyo_au
04-27-2013, 03:12 AM
Check that you have included glew lib correctly

nice87day
04-27-2013, 03:34 AM
hello,

Project/Build options/Linker settings/Link libraries:

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

please help!!!

nice87day
04-27-2013, 12:42 PM
hello,

i extend the link-list with:

..\..\..\..\..\Windows\System32\glew32.dll

and it compiles!!!

nice87day
04-27-2013, 01:08 PM
hello,

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

help

tonyo_au
04-27-2013, 06:59 PM
..\..\..\..\..\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

mobeen
04-28-2013, 09:22 AM
You can also try adding this before glewInit


glewExperimental = GL_TRUE;
GLenum err = glewInit();

see if this helps.