How to get GLFW programs to link on Linux (undefined refrences)

gyroninja wrote on Sunday, June 16, 2013:

After hours of frustrating work I finally got the linker to work and compile my programs with GLFW. In this format and order of libraries.

“g++ -o dist/Debug/GNU-Linux-x86/tuxgui build/Debug/GNU-Linux-x86/main.o pkg-config --libs glfw3 pkg-config --libs gl pkg-config --libs xext pkg-config --libs x11 pkg-config --libs xrandr pkg-config --libs xxf86vm pkg-config --libs xi -lpthread”

So you need to load the libraries in this order. “glfw, gl, xext, x11, xrandr, xxf86vm, xi, and pthread” This problem caused me hours of trouble so I hope this help someone.

elmindreda wrote on Sunday, June 16, 2013:

If you are using the static version of the GLFW library then you need to use the --static flag.