Sunday, February 27, 2011

Setup GLFW project in code::block

TO create GLFW (OpenGL Framework) Project in code::block, at first you have to download the GLFW framework from this website for windows. If you are running another machine then download for that machine from

Let's create a GLFW project
step 1:

first, unzip the zip file
step 2:
copy the glfw.h file from the include folder of unzip file of step 1
and paste to the folder "C:\Program Files\CodeBlocks\MinGW\include\GL"
again copy all file (libglfw.a and libglfwdll.a ) from the lib_mingw folder of unzip file of step 1
and paste to the folder "C:\Program Files\CodeBlocks\MinGW\lib"
also, copy the glfw.dll file from the lib_mingw folder of unzip the file and paste it
inside "C:\Windows\System32" folder.
step 3:
Open the code block you will see window as below and click on create new 
project link

step 4:
click on GLFW project as shown in the image below

Click next

Enter project title name, give a path to save project and project filename is created by default from project title name.

After that click next.

step 5:
now give the path "C:\Program Files\CodeBlocks\MinGW" for glfw location

Then click next

Now click finish

step 6:
Finally, the project is created with default small program built and run it you will see the window as below.

If you see your project output as an above image then you successfully created the project.


  1. followed this tutorial, tried compiling the code that Code::Blocks inserts as a default. The compile crashed, saying "undefined reference to glfwInit()." I made sure that the glfw library is linked to in the build options, still no luck.

  2. Replies
    1. I had the same problem. I think it was because I was using the 32-bit version of CodeBlocks and 64-bit version of GLFW on 64-bit Windows 7.

      The project compiled properly after I followed this articles steps with the 32-bit version of GLFW.

    2. I had the same problem, to sum it up - this worked for me:

      64-bit Windows
      32-bit Codeblocks
      32-bit GLFW

    3. ^^----This guy just solved 8 hours of my problems!

  3. I can't get it work!!!!!

    Previously I used Dev-C++ and it worked, but i could read everywhere that Code::Blocks is better and up-to-date, so I downloaded and installed it with MinGW.
    I had some problems too, but when I read this tutorial and the comments I could solve some of them, now it works better:

    The compiler writes no errors and also it creates the windows I need, but they are BLACK! IT DRAWS NOTHING!
    I also copied the sample code from, it created the window and sill nothing. It was black aswell. So the problem is not in my code.
    Then what can it be? Please help me!

    I have:
    Windows 7 Ultimate 64-bit
    GLFW 3.0.1 32-bit (I tried with 64-bit and it did not work)

  4. Thnx alot! works great.

  5. Thnx alot! works great.