glfw linker error on ubuntu

gcc asd.c  -L/usr/X11R6/lib -lglfw -lGL -lGLU -lX11 -lpthread -lXxf86vm -lm
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_init.o): In function `_glfwPlatformInit':
(.text+0xea): undefined reference to `XRRQueryExtension'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformRefreshWindowParams':
(.text+0x752): undefined reference to `XRRGetScreenInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformRefreshWindowParams':
(.text+0x75c): undefined reference to `XRRConfigCurrentRate'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformRefreshWindowParams':
(.text+0x76a): undefined reference to `XRRFreeScreenConfigInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformCloseWindow':
(.text+0xace): undefined reference to `XRRGetScreenInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformCloseWindow':
(.text+0xaf1): undefined reference to `XRRSetScreenConfig'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformCloseWindow':
(.text+0xafa): undefined reference to `XRRFreeScreenConfigInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformPollEvents':
(.text+0x10d5): undefined reference to `XRRUpdateConfiguration'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_window.o): In function `_glfwPlatformOpenWindow':
(.text+0x1fb7): undefined reference to `XRRSelectInput'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwPlatformGetVideoModes':
(.text+0x195): undefined reference to `XRRGetScreenInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwPlatformGetVideoModes':
(.text+0x1a6): undefined reference to `XRRConfigSizes'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwPlatformGetVideoModes':
(.text+0x1e6): undefined reference to `XRRFreeScreenConfigInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwSetVideoModeMODE':
(.text+0x2e7): undefined reference to `XRRGetScreenInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwSetVideoModeMODE':
(.text+0x302): undefined reference to `XRRConfigCurrentConfiguration'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwSetVideoModeMODE':
(.text+0x352): undefined reference to `XRRSetScreenConfigAndRate'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwSetVideoModeMODE':
(.text+0x36a): undefined reference to `XRRSetScreenConfig'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwGetClosestVideoMode':
(.text+0x3b9): undefined reference to `XRRGetScreenInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwGetClosestVideoMode':
(.text+0x3ca): undefined reference to `XRRConfigSizes'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwGetClosestVideoMode':
(.text+0x445): undefined reference to `XRRConfigRates'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwGetClosestVideoMode':
(.text+0x496): undefined reference to `XRRFreeScreenConfigInfo'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglfw.a(x11_fullscreen.o): In function `_glfwSetVideoModeMODE':
(.text+0x37c): undefined reference to `XRRFreeScreenConfigInfo'
collect2: ld returned 1 exit status

can someone help me please, i am trying to compile one of the examples in glfw site but gets these errors.

Add -lXrandr to linker options.

Thanks! (It wasn’t on the the list that glfw example)

I get “ld: cannot find -lXrandr” when i try that on CodeBlocks. Any hint on what other flags i an use or why it doesn’t work?

try to install it :

sudo apt-get install libxrandr-dev

but on my ubuntu 8.04 it is already there by default. What ubuntu version do you have ?