problems with gl.h?

ok, I am trying to run the first example (the first real code example, not pseudo-code) in the red book, and I keep getting over 100 error messages. The thing is, it says the error messages are in gl.h. I haven’t editted the file in any way. Maybe someone who has it working can post their gl.h or something to see if somehow that is the problem. I can’t think of anything else, and that is what the compiler error messages say. Weird, hm. Thanks, later.


You’re developing on Windows, yes? Official wisdom is that you’re supposed to #include <windows.h> before <GL/gl.h>, since it sets up some required #defines. However, this pollutes the living daylights out of your namespace and is generally something to avoid wherever humanly possible. In practice, I find that if I just put

#if !defined(APIENTRY) && defined(WIN32)
#define APIENTRY __stdcall

#if !defined(WINGDIAPI)

before the #include of <GL/gl.h>, everything’s tickety-boo for both MSVC (8beta1) and GCC (mingw).

Holy **** man! I completely forgot about that, lol. Thanks, it’s still throwing me errors but I think I can get it from here, thanks man.

im a new members here…n just learning about opengl…2 days ago…but i face on problem with it…im using microsoft visual c++ as my compiler…coz in my uNi also this kind of compiler.the problem is…everytime im using the compiler…the is one error pop-up at the ‘debug’
the problem was:-

d:\study\computer graphic ut cs2111_tutorials\lab06files\lab06-viewport1.cpp(8) : fatal error C1083: Cannot open include file: ‘GL\glut.h’: No such file or directory
Error executing cl.exe.

re.exe - 1 error(s), 0 warning(s)

hope can get reply as soon as posibble.
coz right now im workin on my assignment


as an addition…
i already add the opengl library …
opengl32.lib …glu32.lib and glut32.lib in the compiler.

download and install glut library
it is availible in

hm, now I’m getting “The procedure entry point GetPixelFormat could not be located in the dynamic link library OPENGL.dll.” in a windows error box. BTW, I’m using VC++6 and the project type is win32 console application. thanks all, later.

I’m assuming you meant “opengl32.dll”.

GetPixelFormat isn’t an OpenGL function; it’s in gdi32.lib. Are you linking to that?

nope, it says opengl.dll. and no, i wasn’t linking to gdi32.lib, it didn’t come with the glut pack or the opengl pack, hm. i’ll look for it, thanks.

I take it back, i was linking to gdi32.lib.