Open GL in Visual C++

I can’t seem to get Open GL to work in VC++ 5.0. When I compile a program that includes gl/gl.h, it generates 102 errors! Ack! Any ideas?

Are you sure that the gl.h library is in the right spot? It is a pain to configure.

Yeah, its in the right spot. Here’s what its giving me in the little build window thingymajig:

--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling…
Cpp1.cpp
E:\Programming\Devstudio\VC\INCLUDE\gl\gl.h(1135) : error C2501: ‘WINGDIAPI’ : missing decl-specifiers
E:\Programming\Devstudio\VC\INCLUDE\gl\gl.h(1135) : error C2239: unexpected token ‘type’ following declaration of ‘WINGDIAPI’
E:\Programming\Devstudio\VC\INCLUDE\gl\gl.h(1135) : error C2062: type ‘void’ unexpected
E:\Programming\Devstudio\VC\INCLUDE\gl\gl.h(1136) : error C2501: ‘WINGDIAPI’ : missing decl-specifiers

((( TONS OF ERRORS THAT LOOK LIKE THE ABOVE )))

E:\Programming\Devstudio\VC\INCLUDE\gl\gl.h(1160) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.

Cpp1.exe - 102 error(s), 0 warning(s)

The program code is as follows:

#include <gl\gl.h>

int main()
{
return 0;
}

And in the project->settings window, on the link tab, I have:

glu32.lib glaux.lib opengl32.lib glut32.lib

Thanks

try this:
#include <windows.h>
#include <GL/gl.h>

on m$-systems u have to include windows.h before u can include gl.h, because of some structs used in the gl.h, but defined in windows.h

It worked! Thanks a LOT! That is the last thing I would’ve thought of… That is kinda stupid that windows.h MUST be included… Oh well, thanks a LOT!

Thanks thanks.