A very basic question

I have written some simple programs using the Dev C++ IDE. I have Windows 2000 as an OS. I would like to incorporate some OpenGL in my progams. Since OpenGL is written in C, I guess all I have to do is include the OpenGL library, and then proceed to use the OpenGL commands, which are just functions written in C and defined in the library. However, I am little confused about the exact steps I need to take, even after looking at tutorials on the subject. If some one could give a pointer or two, I would appreciate it.

You need to add the opengl library to your linker step, -lopengl32 and maybe -lglu32 on MinGW, I am not sure where you do that on DevC++.

That is all you have to do, you will need to include the <GL/gl.h> header file also of course.

I guess you have a dialog box somewhere in C++ where you can set the libraries to include in the linker step.

Some of the NeHe tutorials are available for DevC++, they should work pretty much of the box.


TIP: Do not forget to include windows.h before gl.h


C++ can call C provided the function declarations in the header are inside an extern “C” { } block, gl.h supports this. Apart from this just include and link as normal.

Dev-C++ is ready to use OpenGL right away. It also provides a project template for OpenGL, so you can create new OpenGL project file very easily in Dev-C++. Go to
“File” > “New” > “Project” > “Multimedia”.
You can see an icon for OpenGL template to start with a very simple program.

Also, you can use GLUT in Dev-C++. There are several packages I personally use glut.3.7.6+. Download them from here: