In this article, we’ll set up Dev-C++ to use the graphics library GLUT. Follow the steps carefully to make it work smoothly.

✅ Requirements

📥 Step 1: Download & Install

  • Download and install Dev-C++ 32-bit
    (You’ll find it installed at this path on Windows):
C:\Program Files (x86)\Dev-Cpp
  • Download the freeglut MinGW 32-bit ZIP file and extract it.

📁 Step 2: Copy Required Files

Copy From (freeglut)Paste To (Dev-C++)
include\GL*.hC:\Program Files (x86)\Dev-Cpp\include\GL
lib/libfreeglut.aC:\Program Files (x86)\Dev-Cpp\lib
bin/freeglut.dllC:\Windows\SysWOW64

🔸 freeglut.dll must be placed in SysWOW64 because it’s a 32-bit DLL and your system is likely 64-bit. If not, then go ahead with System32

⚙️ Step 3: Configure Dev-C++

Open Dev-C++, then:

Go to:
Project > Project Options > Parameters

➤ In the Linker section, add:

-lfreeglut -lopengl32 -lglu32

Later, set this drop down bar, shown in figure-1, to 32-bit release from 64-bit release.

Figure-1

Now, run your code.

⚠️ Still Getting Errors?

Sometimes, Dev-C++ may not locate the library files properly. You can fix this by explicitly specifying the paths.

➤ In the C++ Compiler section, add:

-I"C:\Program Files (x86)\Dev-Cpp\include"

➤ In the Linker section, replace with:

-L"C:\Program Files (x86)\Dev-Cpp\lib" -lfreeglut -lopengl32 -lglu32

🧪 Step 4: Run Your Program

Now you can write and run OpenGL code using <GL/glut.h> in Dev-C++ without errors.

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

void display() {
    glClear(GL_COLOR_BUFFER_BIT);
    glFlush();
}

int main(int argc, char** argv) {
    glutInit(&argc, argv);
    glutCreateWindow("OpenGL Setup Test");
    glutInitWindowSize(500, 500);
    glutInitWindowPosition(100, 100);
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}

Now, it should work. Good luck.

Categorized in:

Technology,

Last Update: July 15, 2025