Menu

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

Using GLFW
gyroninja
2013-06-16
2013-06-16
  • gyroninja

    gyroninja - 2013-06-16

    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

    elmindreda - 2013-06-16

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