PDA

View Full Version : compiling help please



06-28-2003, 02:09 PM
Having problems getting OpenGL to compile properly under VC++ .NET. I've included all the correct files and believe I have setup the linker correctly with opengl32.lib and glu32.lib. However, when I try to build every OpenGL call I make returns an undeclared identifier error, like it can't find the libraries. Any help with this would be greatly appreciated.

shinpaughp
06-28-2003, 03:05 PM
might be easier if you copy the the errors and post them.

but, could be that you are trying to use functionality for OpenGL v1.2 or greater that exists only in extensions. The OpenGL libs and dlls only support thru v1.1 and all additional functionality exists in the drivers which you access as extensions using wglGetProcAddress. Information about extensions can be found here (http://www.opengl.org/developers/faqs/technical/extensions.htm) .


[This message has been edited by shinpaughp (edited 06-28-2003).]

06-28-2003, 05:05 PM
Ok here's what I'm including.

#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>

then I added opengl32.lib and glu32.lib to the linker. I'm just testing the simple program in the beginning of the OpenGL Game Programming book. I'm using the libs and dlls provide with .NET.

here are the errors:

c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(230): error C2065: 'GL_MODELVIEW' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(228): error C2059: syntax error : ')'
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(228): error C2146: syntax error : missing ')' before identifier 'width'
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(228): error C2065: 'GLfloat' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(228): error C2065: 'gluPerspective' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(225): error C2065: 'GL_PROJECTION' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(225): error C2065: 'glMatrixMode' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(224): error C2065: 'glViewport' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(195): error C2065: 'hwnd' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(96): error C2065: 'glEnd' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(93): error C2065: 'glVertex3f' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(92): error C2065: 'GL_TRIANGLES' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(92): error C2065: 'glBegin' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(91): error C2065: 'glColor3f' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(89): error C2065: 'glRotatef' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(88): error C2065: 'glTranslatef' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(83): error C2065: 'glLoadIdentity' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(82): error C2297: '|' : illegal, right operand has type ''unknown-type''
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(82): error C2296: '|' : illegal, left operand has type ''unknown-type''
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(82): error C2065: 'GL_DEPTH_BUFFER_BIT' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(82): error C2065: 'GL_COLOR_BUFFER_BIT' : undeclared identifier
c:\Documents and Settings\Michael\My Documents\Visual Studio Projects\test\test.cpp(82): error C2065: 'glClear' : undeclared identifier

06-28-2003, 05:08 PM
Just tried including glaux.lib and have tried glaux.dll, but that doesn't solve the problem either

The_Dj
06-28-2003, 05:17 PM
You need to include the Library directory with the -L switch, and include the .dll's individualy with -l switches.

Also, I use
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>

with a capital GL. They are diferent libraries to the ones you yse. I don't know what the diference is, but the ones I use solved similar problems.

06-28-2003, 07:19 PM
What do you mean with the -L and -l switches?? Also where do I specify directories to include? one last thing do the dll's go into additional dependencies just like the lib's do?

06-28-2003, 07:25 PM
Alright guys. I was being a big, big idiot. Turns out I forgot to move stdafx.h to the top of the file. It works now http://www.opengl.org/discussion_boards/ubb/smile.gif. Thanks for the help though.