I am a newbie to opengl, and haven’t even compiled one program using it because my compiler keeps giving me these weird linker errors.
I put all needed .h and .lib files where needed (C:\Dev-Cpp\include and C:\Dev-Cpp\lib).
Here is the specific program in question, although very similar problems are present in all other gl code i tried to compile:
#include <windows.h>
#include <GL/glut.h>
#include <GL/gl.h>
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush();
//UpdateTheWindowAndCheckForEvents();
}
and here are the linker’s complaints:
C:\DOCUME~1\LEV~1.WOW\LOCALS~1\Temp\ccCccaaa.o(.text+0x1c) In function `glutInit_ATEXIT_HACK':
[Linker error] undefined reference to `__glutInitWithExit@12'
C:\DOCUME~1\LEV~1.WOW\LOCALS~1\Temp\ccCccaaa.o(.text+0x3d) In function `glutCreateWindow_ATEXIT_HACK':
[Linker error] undefined reference to `__glutCreateWindowWithExit@8'
There are a lot more. Basically linker complaints about every gl and glut function.
I am at a loss here, and all of this is very frustrating and confusing.