Setting Up GLFW for Visual Studio

Setting up GLFW is not that different than setting up GLEW. The only difference, if you go directly to GLFW download page, they give two Windows pre-compiled binaries (32-bit and 64-bit). So, download the one you need depending the project you are developing. Otherwise, it won’t work.

Download and Extract

  1. Download the binaries you need (32-bit or 64-bit)
  2. Extract the binaries (Preferably into “Dependencies” folder of the project.

Adding Include

  1. Copy path of include (SomeOtherStuff\glfw-SOMEINFORMATION.WIN32orWIN64\include). For me it’s …\dependencies\glfw-3.1.2.bin.WIN64\include
  2. Go to your project opened in Visual Studio
  3. Go to Project Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories
  4. Paste the path, be sure path is correct. Click OK (and Apply)

Adding Lib Files

For this step, you should copy the path of the binary related with Visual Studio you’re using. For example, if you use Visual Studio 2012, you should copy path of VS2012 binaries (folder named lib-vc2012 for GLFW 3.1.2). If you use Visual Studio 2015, you should copy path of lib-vc2015 folder.

  1. Copy path of correct .lib files. For example, for my case (since I’m using VS 2013 and my project is 64-bit) it is …\dependencies\glfw-3.1.2.bin.WIN64\lib-vc2013)
  2. Go to your project opened in Visual Studio
  3. Go to Project Properties -> Configuration Properties -> Linker -> General -> Additional Library Directories
  4. Paste the path and click OK (and Apply).
  5. Finally, go to Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies and type the next two things: glfw3.lib and glfw3dll.lib
  6. Click OK, then Apply, and then OK. Hopefully, you are good to go.

Troubleshooting

Run Time:

If it says something like “glfw3.dll is missing”, just go to .lib folder you pasted in Adding Lib Files step, and copy-paste the dll into the same directory you .exe is located i.e. Debug file.