PDA

View Full Version : link errorrs... beginner.. please help



pmr2004pmr
10-15-2004, 11:48 AM
Hello. I am a beginner at open gl. I am trying to run my first simple program but am having problems. I am trying to run this simple program which draws 3 dots:

#include <windows.h>
#include <GL/gl.h>
#include <gl/glut.h>

void myInit(void)
{
glClearColor(1.0, 1.0, 1.0, 0.0);
glColor3f(0.0f, 0.0f, 0.0f);
glPointSize(4.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}

void myDisplay(void )
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
glVertex2i(100, 50);
glVertex2i(100, 130);
glVertex2i(150, 130);
glEnd();
glFlush();
}

void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(640, 480);
glutInitWindowPosition(100, 150);
glutCreateWindow("Drawing some dots");
glutDisplayFunc(myDisplay);
myInit();
glutMainLoop();
}

The program compiles ok but when I build it I get the following errors:

Compiling...
Assignment1.cpp
Linking...
Assignment1.obj : error LNK2001: unresolved external symbol _gluOrtho2D@32
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glPointSize@4
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glColor3f@12
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glFlush@0
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glVertex2i@8
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
Assignment1.obj : error LNK2001: unresolved external symbol __imp__glClear@4
Assignment1.obj : error LNK2001: unresolved external symbol _glutMainLoop@0
Assignment1.obj : error LNK2001: unresolved external symbol _glutDisplayFunc@4
Assignment1.obj : error LNK2001: unresolved external symbol _glutCreateWindow@4
Assignment1.obj : error LNK2001: unresolved external symbol _glutInitWindowPosition@8
Assignment1.obj : error LNK2001: unresolved external symbol _glutInitWindowSize@8
Assignment1.obj : error LNK2001: unresolved external symbol _glutInitDisplayMode@4
Assignment1.obj : error LNK2001: unresolved external symbol _glutInit@8
Debug/Assignment1.exe : fatal error LNK1120: 18 unresolved externals
Error executing link.exe.

Assignment1.exe - 19 error(s), 0 warning(s)

I think I put all the correct files in the correct places. I am using microsoft visual c++ 6 running windows xp. Any ideas where I am going wrong. Please go slowly with me this is the first time I have ever used open gl.

Thanks

pmr2004pmr
10-15-2004, 12:01 PM
Have solved it.... don't worry guys.