Archived

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

The GL.H file for C++ compiler

This topic is 5145 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
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
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
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
quote:
Original post by superdeveloper
...add opengl32.lib into you linker path

if you want to do it programatically, do this:
#pragma comment(lib, "opengl32.lib")


Thanks, but still I have remaining errors (only 14 left...).
E.G. Main.obj : error LNK2001: unresolved external symbol __SDL_GetError

Thanks for all your help so far everybody.

HunterX

Share this post


Link to post
Share on other sites
now you should link to sdl.lib, too..

and then set your app to multithreaded dll, too.. and don''t forget to link to sdlmain.lib, too




If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net

Share this post


Link to post
Share on other sites
Project->Settings menu.
Go to the C/C++ tab, and in that drop down choose Linker settings (or something very close to that). Once you select it, there will be a long textfield with all sorts of files listed like kernel32.lib, and other .lib files. Put opengl32.lib, sdl.lib, and sdlmain.lib in there somewhere.

Alternatively, use the #pragma comment as shown before. I''d recommend against this, personally.


To set it as a multithreaded DLL, goto Project->Settings again.
Go to the C/C++ tab, and choose Runtime Library in the drop down. One of those drop downs will say "Singlethreaded" or something close to that, change it to Multithreaded DLL.

Share this post


Link to post
Share on other sites
Looks better now. Now I only have 4 errors left...

Main.obj : error LNK2001: unresolved external symbol _gluPerspective@32

Main.obj : error LNK2001: unresolved external symbol _gluLookAt@72

sdlmain.obj(SDL_main.ojb) : error LNK2001: unresolved external symbol _SDL_main

Debug/Main.exe : fatal error LNK1120: 3 unresolved externals

This is kind of embarrasing to ask you about, but thanks for all the help you give me!

Share this post


Link to post
Share on other sites
When I do all this, I get only 2 errors.

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

and

Debug\Main.exe : fatal error LNK 2001: 1 unresolved externals

I''m sorry, but I just do not see what is still missing!

Thanks for help and patience.

HunterX

Share this post


Link to post
Share on other sites
SDL uses its own gl.h file. it should be in your SDL directory the include directory of your compiler. the line to include it is:

#include "sdl/sdl_opengl.h"

Instead of:

#include "gl/gl.h"

*I think*

Also goto the SDL web site and download the manual http://www.libsdl.org/docs.php it has a tutorial on how to set OGL up with SDL.

[edited by - sckoobs on November 11, 2003 11:39:19 AM]

Share this post


Link to post
Share on other sites