PDA

View Full Version : errors



10-05-2005, 10:41 PM
am trying to compile some tutorials from nehe.and iam gettin these errors.i know it has something to do with the libraries.i have already installed it and i dont know why its still giving those erreors.

c:\documents and settings\ray\desktop\l1.cpp(32) : error C2065: 'glViewport' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(34) : error C2065: 'glMatrixMode' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(35) : error C2065: 'glLoadIdentity' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(46) : error C2065: 'glShadeModel' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(47) : error C2065: 'glClearColor' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(48) : error C2065: 'glClearDepth' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(49) : error C2065: 'glEnable' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(50) : error C2065: 'glDepthFunc' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(51) : error C2065: 'glHint' : undeclared identifier
c:\documents and settings\ray\desktop\l1.cpp(57) : error C2065: 'glClear' : undeclared identifier
Error executing cl.exe.

can someone help me please. :(

10-05-2005, 11:05 PM
It's a matter of linking. If you're using an IDE like Dev C++ you have to go to Project->Project Options->Parameters and in the area named Linker you have to write

-lopengl32
-lglu32
-lglut32

In Visual C++ it's something similar.
The point is: it's not enough you put <GL\glut.h> or the other headers in your source code. You also have to say to the linker that your program needs to be linked to these libraries.
Bye