Problem with SDL/OpenGL & Visual C++ 6

I did a small project with SDL/OpenGL using the MacOS X Project Builder. When I
try to compile it with Visual C++, I get the following error message:

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : error
C2144: syntax error : missing ‘;’ before type 'void’
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : error
C2501: ‘WINGDIAPI’ : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : fatal
error C1004: unexpected end of file found

For some reason VC++ doesn’t like the gl.h file I have, but reinstalling the
OpenGL headers/libraries doesn’t fix it. I’ve been mucking around, trying to fix
this problem, but am really at my wits’ end here. Any insight would be much
appriciated.

–Nathan

Nathan Demick wrote:

For some reason VC++ doesn’t like the gl.h file I have, but reinstalling the
OpenGL headers/libraries doesn’t fix it. I’ve been mucking around, trying to fix
this problem, but am really at my wits’ end here. Any insight would be much
appriciated.

  • try inserting

#ifdef WIN32
#include <windows.h>
#endif

  • before
    #include <GL/gl.h>

And you should link to opengl32.lib, sdlmain.lib, sdl.lib. Furthermore
if linking dynamically (which is the most common I guess), you should set:
in project settings -> C/C++ -> Category [Code Generation] ->
Multithreaded DLL

  • instead of single-threaded!

Regards,
\Mikkel Gjoel

The Win32 versions of the GL header files require that you #include
windows.h before gl.h/glu.h/glut.h, so that you get the #define types like
WINGDIAPI and such. That should clear up all 5-6 hundred errors that it
generates that look like the ones you sent below (geez it would be handy if
the GL headers included it for you, since they depend on them).

  • Alex> ----- Original Message -----

From: ndemick@cse.unl.edu (Nathan Demick)
To:
Sent: Thursday, February 19, 2004 4:52 AM
Subject: [SDL] Problem with SDL/OpenGL & Visual C++ 6

I did a small project with SDL/OpenGL using the MacOS X Project Builder.
When I
try to compile it with Visual C++, I get the following error message:

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) :
error
C2144: syntax error : missing ‘;’ before type 'void’
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) :
error
C2501: ‘WINGDIAPI’ : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) :
fatal
error C1004: unexpected end of file found

For some reason VC++ doesn’t like the gl.h file I have, but reinstalling
the
OpenGL headers/libraries doesn’t fix it. I’ve been mucking around, trying
to fix
this problem, but am really at my wits’ end here. Any insight would be
much
appriciated.

–Nathan


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.580 / Virus Database: 367 - Release Date: 2/6/2004

Heya,

I think you’re not including windows.h. And if you do, be sure to
include it before you include the opengl headers.

Let me know how it works out!

Marc

Nathan Demick wrote:> I did a small project with SDL/OpenGL using the MacOS X Project Builder. When I

try to compile it with Visual C++, I get the following error message:

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : error
C2144: syntax error : missing ‘;’ before type 'void’
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : error
C2501: ‘WINGDIAPI’ : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : fatal
error C1004: unexpected end of file found

For some reason VC++ doesn’t like the gl.h file I have, but reinstalling the
OpenGL headers/libraries doesn’t fix it. I’ve been mucking around, trying to fix
this problem, but am really at my wits’ end here. Any insight would be much
appriciated.

–Nathan


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I did a small project with SDL/OpenGL using the MacOS X Project Builder. When I
try to compile it with Visual C++, I get the following error message:

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : error
C2144: syntax error : missing ‘;’ before type 'void’
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : error
C2501: ‘WINGDIAPI’ : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1151) : fatal
error C1004: unexpected end of file found

Are you including SDL_opengl.h or are you including gl.h directly?
Guess which one I recommend? :slight_smile:

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment