How compile GLFW in Linux?

I’m trying to build GLFW 3.2.1 on my Linux (Fedora) to use in the CodeBlocks IDE. The steps I’m following are: 1- In the extracted folder, I execute the “cmake -DBUILD_SHARED_LIBS=ON .” Command. 2- In the same folder, I execute the command “sudo make install”.

I do not know if that’s the right method. Now I need to show CodeBlocks where the GLFW is. I can not get past this part. Can someone help me? (I’m following the tutorial to compile from this site:

I don’t know Code::Blocks well enough to give a full answer, but perhaps the following will help:

First off the tutorial you’ve read is for compiling GLFW itself, you should now move on to reading how to build an application with GLFW.

If you use cmake for your project you can then output a Code::Blocks project, see GLFW + Code::Blocks + Ubuntu

The Code::Blocks wiki has a section on GLFW however it’s a little confusing.

It appears there the Code::Blocks ‘template’ for GLFW might be out of date, see

You might also want to ask this question on the Code::Blocks forum as it’s more about how to use Code::Blocks than about GLFW.

1 Like

I used the following steps to compile glfw on my machine:
1- Unzipped the zip file I downloaded from the site
2- In the folder generated by the decompression I executed the command “cmake.”
3- in the same folder I ran the command “make”
4 - lastly I ran the command “sudo make install”

Is this the right way to compile GLFW?

If you used the commands as per your first post:


Then you have should have compiled glfw, if cmake or make didn’t report any errors. After the cmake command you should have seen something like:

-- build files have been written to: a/path/somewhere

Note that GLFW cmake will output a few -- Could NOT find X which is fine as some dependencies are not always required (for example Vulkan and Doxygen). After running make you should see lots of output without errors.

You should be able to see a folder src with some files called* (some are links to the real file). If you have these created you can proceed to building your application.

The command sudo make install is only needed to install the library to your system so you can more easily use it to compile multiple programs.