Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

HunterX

The GL.H file for C++ compiler

This topic is 5429 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I downloaded some toturials from a web page, and I read them, and I think I understood as well. But when I came to the point where I was supposed to compile the 3D model/object (using SDL), I get an annoying error from the compiler. Somehow it seems that the GL.H header file is either corrupt, or too old for the program. Therefor I was wondering if someone of you knew the location of a working GL.H file... HunterX

Share this post


Link to post
Share on other sites
Advertisement
I use the MSVisual C++ compiler, and I get the compile error:

d:\.....\gl\gl.h(1152) : error C2144: syntax error : missing '';'' before type ''void''

d:\.....\gl\gl.h(1152) : error C2501: ''WINGDIAPI'' : missing storage-class or type specifiers

d:\.....\gl\gl.h(1152) : fatal error C1004: unexpected end of file found

Since nearly the same line continues downwards in the GL.H file, I would suppose that the same errors would occur downwards, but I''m not certain.

Share this post


Link to post
Share on other sites
Are you including window.h before the OpenGL header?

With the GL libs that came with MSVC++ 6 you need to include the windows header before the GL headers.

Share this post


Link to post
Share on other sites
Yep, you haven''t included windows.h first. Do this:


#define WIN32_LEAN_AND_MEAN
#include <windows.h>

//and THEN do this
#include <GL/gl.h>

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
If gl.h requires windows.h to be included, why isn''t it including it itself?


It''s halfway to platform independence. GL.h doesn''t really need Windows.h, it just isn''t as good as the other Platform SDK headers at defining what it needs. The only unrecognized identifiers in GL.h are WINGDIAPI and APIENTRY, which can be declared as __declspec(dllimport) and __stdcall, respectively.


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
The first section of glut.h does Win32 stuff for gl.h on windows without including windows.h. Windows.h can be very heavy if you don''t need most of it, and that''s a decent way to go.

Share this post


Link to post
Share on other sites
quote:
Original post by Promit
Yep, you haven''t included windows.h first. Do this:


#define WIN32_LEAN_AND_MEAN
#include <windows.h>

//and THEN do this
#include <GL/gl.h>



Thanks, but when I do this, I get a lot of new error messages.
E.G. Main.obj : error LNK2001: unresolved external symbol __imp__glEnd@0

There are also 21 other similar errors...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!