Another newbie needs alot of help to get started

I know that questions like this have been asked hundreds of times, but I’ve exhausted all of my local resources, and I still need major help. If the question is too basic for this place, can you please direct me to some other source?

I can’t seem to get OpenGL to work on my system. I’m running Windows 98 with the DJGPP compiler. I put gl.h and glu.h in c:\djgpp\include\gl. OpenGl32.lib and glu32.lib are in c:\djgpp\lib. My windows\system directory already had glu32.dll and opengl32.dll. Then downloaded precompiled glut files from , and put glut32.dll in windows\system, glut.h in djgpp\include\gl, and glut32.lib in djgpp\lib.

I got some sample code and then used

gcc code.c -o code.exe -lglut32 -lglu32 -lopengl32 -lm

On every line in gl.h between lines 1135 and 1470 I get syntax error before ‘void’ and “warning: data has no definition or storage class,” and in glu.h I get parse errors with the same warning.

The sample code includes <GL\glut.h>. Do I need windows.h as well?


yes!! you need to include:

#include <windows.h>
#include <gl/glut.h>

and always in that order!! windows before glut. Also do not forget to link the glut32.lib to you program. I hope this solves you problem. Check the readme on you compiler on how to link the lib file.

Thanks for the reply.

I do not have windows.h in my computer, and after scouring the net I still can’t find it. I’m guessing it comes with some Windows SDK that one can download from Microsoft. Can you direct me to the place where I can get it?

Also, will the file go in my compiler’s lib directory (c:\djgpp\lib)? I noticed that all of the files in there have an .a extension. Does DJGPP even support .lib? If not, how do I convert opengl32.lib, glut32.lib, and glu32.lib into .a files?


Well I found Windows.h and dropped it in the include directory. I added the #include <Windows.h> before the other #include statements, and compiled with gcc code.c -o code.exe -lglut32 -lglu32 -lopengl32. Now, in addition to all the previous errors, I get a couple hundred in the windows.h file.

You stated that I should link the glut32.lib to my program. I’m not very familiar with the syntax, but I thought that the -lglut32 on the command line accomplished that.

Maybe the problem is those .lib files.

I am sorry, I am not familiar with your compiler, I now know that your compiler does not come with the win32 library, you cannot just drop windows.h in the include driectory and expect that to work, it comes with many other components. If you would open whindows.h you could see that you need many other header files and maybe many other .lib files. My suggestion to you is that you get Borland c++ or visual c++, that comes with all the necessary libraries and headers.


opengl and djgpp! You are definately trying for something divine. Most of the work for DJGPP was just to move a linux 32 bit compiler over to windows pre-32. It can be found at DJGPP is a good C++ compiler (I liked it quite a bit), but (and this is just memory here) I don’t think it has any real windowing capabilities and relys more on it’s linux roots than it’s windows library compliance. Otherwise you might want to lie, cheat and steal a copy of Visual C++ or Codewarrior.

Thanks for the replies.

I just went to DJPP because it was free, and I had used it a couple of years ago for some non-graphics programming.

Anyway, if I download the free Borland compiler, will there be any issues that I should be warned about? Or can I just create the include\GL directory and place the glut files in the right place?

Or should I just drop the hundred and get visual c++? I don’t mind using command-line compilers at all, but I just want to start opengl programming as soon as possible.


That’s funny. I was just gonna suggest you try the downloadable borland compiler. I downloaded it last year but I never got around to playing with it. Let me know if it works.


Wow. I download the Borland compiler, and after half an hour I compiled my first opengl program error-free. After messing with DJGPP for 3 days, I can finally move on to bigger and better things!

There was one small problem, though. The precompiled glut32.lib from SGI apperently only works with Microsoft compilers. I got a precompiled Borland version here:


The reason DJGPP didn’t work was because it is a DOS compiler, it won’t produce a Win32 executable. As for the free borland compiler, its pretty good, just don’t use their DirectX libs, they were painfully screwed last time I used them.