PDA

View Full Version : Persistent Linker Error



dehon
10-29-2009, 08:14 PM
Trying to compile this simple opengl/GLUT program in C:

#include <GL/gl.h> //include the gl header file
#include <GL/glut.h> //include the glut header file

void display (void) {
glClearColor (0.0,0.0,0.0,1.0); //clear the color of the window
glClear (GL_COLOR_BUFFER_BIT); //Clear teh Color Buffer (more buffers later on)
glLoadIdentity(); //load the Identity Matrix
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); //set the view
glFlush(); //flush it all to the screen
}

int main (int argc, char **argv) {
glutInit (&amp;argc, argv); //initialize the program.
glutInitDisplayMode (GLUT_SINGLE); //set up a basic display buffer (only singular for now)
glutInitWindowSize (500, 500); //set whe width and height of the window
glutInitWindowPosition (100, 100); //set the position of the window
glutCreateWindow ("A basic OpenGL Window"); //set the caption for the window
glutDisplayFunc (display); //call the display function to draw our world
glutMainLoop (); //initialize the OpenGL loop cycle
return 0;
}


I'm getting these link errors when trying to compile, I'm using Dev-C++ in windows XP:

[Linker error] undefined reference to `__glutInitWithExit@12'
[Linker error] undefined reference to `__glutCreateWindowWithExit@8'
[Linker error] undefined reference to `__glutCreateMenuWithExit@8'

I have these for the linker parameters: -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32

I put glut.h in include/GL as well as glut32.lib in the lib directory, and glut32.dll and glut.dll in C:\WINDOWS\system32, I've done just about every damn thing and it isn't linking, I would greatly appreciate if someone could please tell me what I'm doing wrong

fixed by doing random stuff, even though the conditions seem exactly the same as when i had the problem..