Glut setup for CodeBlocks | Windows

Mehedi Hasan
3 min readFeb 7, 2022

CodeBlocks is one of my favourite IDE for C programming. And yesterday when I was just trying to set up glut I’m just getting a whole list of errors. It didn’t worked the way it used to work after setup, maybe for codeblocks version?!

And I had to spend quite some time searching google to solve these errors and make it work. This post is mainly as a reminder to myself for future use and to help others who may face the same problem as me.

OS : Windows 10 64bit
CodeBlocks : v20.03
  1. Glut file download

https://www.transmissionzero.co.uk/software/freeglut-devel/

Glut MinGW Package
Download Glut MinGW Package

Info: GLUT comes in two flavours for Windows. There’s an old and unmaintained version called GLUT and an open source alternative called freeglut.

2. Unzip the file. You will see 3 following folder bin, include, lib.

unzip files of downloaded glut file

3. Now copy the “include” folder & paste it at the “ …\codeblocks\mingw \x86_64-w64-mingw32 ” folder. Since my codeblocks in c drive, so the path for that,

C:\Program Files\CodeBlocks\MinGW\x86_64-w64-mingw32
paste include folder in x86_64-w64-mingw32

4. Copy all files from “ …\freeglut\lib\x64 ” folder (since my OS is 64bit)

copy files from lib folder

Paste these files in lib folder of codeblocks

C:\Program Files\CodeBlocks\MinGW\x86_64-w64-mingw32\lib
paste lib files here

5. Copy freeglut.dll from “ …\freeglut\bin\x64 ” folder

copy freeglut.dll

Paste dll file in following folder

C:\Windows

Our primary set up is done. Now we’ve to edit 2 file to complete.

Go to “ ..\CodeBlocks\share\CodeBlocks\templates

C:\Program Files\CodeBlocks\share\CodeBlocks\templates

Find & open file ‘ glut.cbp ’. Search ‘ glut32 ’ & replace it with ‘ freeglut ’.

Find & replace glut32 with freeglut

Again find & open ‘ wizard.script ’ file from folder “CodeBlocks\share\CodeBlocks\templates\wizard\glut”. Search ‘ glut32 ’ & replace it with ‘ freeglut ’.

C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\glut
Find & replace glut32 with freeglut

Now when create glut project give Glut location to ‘x86_64-w64-mingw32’ folder.

C:\Program Files\CodeBlocks\MinGW\x86_64-w64-mingw32
selecting glut location

That’s It!! (。・∀・)ノ゙You’re good to go.

default glut project successfully run

--

--