Compilng and linking GLFW on Linux

If you are new to OpenGL programming and are using terminal and vim as I do, you might find some issues in including the required libraries and linking them for execution in you linux machine.

To successfully build and run OpenGL programs that includes GLFW libraries on my ubuntu 14.04, I did the following:

Note that you need to have cmake and various other build dependencies installed. Try using sudo apt-get build-dep glfw3 or manually install the required dependencies.

g++ -std=c++11 -Wall -o main main.cpp -lglfw3 -lGLU -lGL -lX11 -lXxf86vm -lXrandr -lpthread -lXi

You have successfully ran an OpenGL program with GLFW library installed in your Linux.