OpenGL and MS Visual C++ 6.0

OpenGL and MS Visual C++ 6.0

Post by Israelbe » Fri, 07 May 1999 04:00:00



In attempting to follow the first example in the "OpenGL Programming Guide", I
got the following 3 errors by simply trying to include <GL/gl.h> into either a
Win32 Console Application or Win32 Application 'project'.  The same #include
works fine in an MFC Appwizard(exe) 'project'.  In learning the basics of
OpenGL I don't want to have to deal with MFC, so my question is how do you get
OpenGL support in Win32 Console Application or Win32 Applications?  

These are the exact errors issued by the compiler.

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error
C2144: syntax error : missing ';' before type 'void'

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error
C2501: 'WINGDIAPI' : missing storage-class or type specifiers

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal
error C1004: unexpected end of file found

Feel free to respond directly to my email.  If you have a simple workspace
example I'd be very grateful.  
Sincerely,
Benjmain Israel

 
 
 

OpenGL and MS Visual C++ 6.0

Post by Iain Hutchiso » Fri, 07 May 1999 04:00:00



> In attempting to follow the first example in the "OpenGL Programming Guide", I
> got the following 3 errors by simply trying to include <GL/gl.h> into either a
> Win32 Console Application or Win32 Application 'project'.  The same #include
> works fine in an MFC Appwizard(exe) 'project'.  In learning the basics of
> OpenGL I don't want to have to deal with MFC, so my question is how do you get
> OpenGL support in Win32 Console Application or Win32 Applications?

> These are the exact errors issued by the compiler.

> c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error
> C2144: syntax error : missing ';' before type 'void'

> c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error
> C2501: 'WINGDIAPI' : missing storage-class or type specifiers

> c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal
> error C1004: unexpected end of file found

You need to include 'windows.h' before 'GL/gl.h'.  If you want your code
to remain portable then put this :

#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <GL/gl.h>

If you're not worried about portability then you can chop out the #ifdef
and #endif.

+------------------------------------------+
| Iain Hutchison                           |
| 3rd Year Computation - St Anne's College |


+------------------------------------------+

 
 
 

OpenGL and MS Visual C++ 6.0

Post by Israelbe » Fri, 07 May 1999 04:00:00


Well now I feel a little dumb.  But that's all right.  At least the problem is
fixed, and so easily too.  Thank you.

Sincerely,
Benjmain Israel