PDA

View Full Version : Getting OpenGL to work



HQSneaker
08-11-2004, 11:00 AM
Hi, I'm learning OpenGL and I've downloaded Lesson #1 from NeHe (http://nehe.gamedev.net) . When I try to compile I get 115 errors, here are a few:

c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(60) : error C2143: syntax error : missing ';' before '*'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(60) : error C2734: 'GLubyte' : const object must be initialized if not extern
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2065: 'GLenum' : undeclared identifier
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2146: syntax error : missing ')' before identifier 'errCode'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2501: 'gluErrorString' : missing storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(64) : error C2146: syntax error : missing ')' before identifier 'errCode'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(64) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(64) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(66) : error C2143: syntax error : missing ';' before '*'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(66) : error C2734: 'GLubyte' : const object must be initialized if not extern
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(66) : error C2086: 'const int GLubyte' : redefinition
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(60) : see declaration of 'GLubyte'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : error C2146: syntax error : missing ')' before identifier 'name'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : error C2501: 'gluGetString' : missing storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(70) : error C2065: 'GLdouble' : undeclared identifierI'm linking the libraries like this:


/MACHINE:I386 opengl.lib glu32.lib glaux.lib kernel32.liband I use MSVS .NET. What am I doing wrong?

Thanks in advance

08-11-2004, 11:28 AM
try including windows.h before gl.h and glu.h.

:)

HQSneaker
08-11-2004, 11:41 AM
I've already done that, here are my includes:


#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>;)

08-11-2004, 12:05 PM
i think you want to link with opengl32.lib, not opengl.lib.

the errors you posted, are they the first few listed? (generally thats what we want to look at)
it looks like some things arent defined - types and so on. that generally indicates some header trouble...

i dont use vc7, so im just hinting to some common problems with vc6.

HQSneaker
08-11-2004, 11:55 PM
The opengl32.lib was a typo :p

Yes these are the first errors on the list.
As you can see they occur in GL.h, all the following errors occur in the other two OpenGL includes. Only thing to do is solve this :confused:

08-12-2004, 12:17 AM
hmm, dunno. i know that with vc6, windows.h includes the definitions for WINGDIAPI and APIENTRY (both are needed by gl).

maybe someone who uses vc7 can suggest something...

:)

Jan
08-12-2004, 02:53 AM
You seem to be doing everything ok.
What happens, if you downloads Nehe´s VS 7 code and open that workspace? Does it compile then?

Jan.

HQSneaker
08-12-2004, 05:49 AM
I also link with kernel32.lib.

I downloaded the VS .NET code here (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01)
The weirdest thing is the errors occur in the headers. I'd really appreciate it if you try the NeHe code on your compiler to see if it works :)