openGL 3 issue : undefined reference to _glapi_tls_Dispatch

I'm trying to compile a simple test program from :

#include <GLFW/glfw3.h>
#include <thread>

int main()

I use the following to compile:

>> g++ -c tutorial01.cpp -o tutorial01.o -std=c++11
>> g++  tutorial01.o -o tutorial01 -lglfw3 -lGL -lXrandr -lX11 -lXi -lGLEW
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/ undefined reference to `_glapi_tls_Dispatch'
collect2: error: ld returned 1 exit status

Here are some extra info about the problem:

>> readlink -f "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/"

>> nm -D /usr/lib/x86_64-linux-gnu/ | grep _glapi_tls_Dispatch
U _glapi_tls_Dispatch

>> ldd /usr/lib/x86_64-linux-gnu/ (0x00007fff0b200000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff437f80000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff437d68000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff437b60000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff437958000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff437750000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff437410000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff4371f8000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff436ff0000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff436dd0000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff436bc8000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff4369b8000) => /lib/x86_64-linux-gnu/ (0x00007ff4366b0000) => /lib/x86_64-linux-gnu/ (0x00007ff436490000) => /lib/x86_64-linux-gnu/ (0x00007ff436288000) => /lib/x86_64-linux-gnu/ (0x00007ff435ed8000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff435cd0000) => /usr/lib/x86_64-linux-gnu/ (0x00007ff435ac8000)
/lib64/ (0x00007ff438428000)

>> nm -D /usr/lib/x86_64-linux-gnu/ |grep _glapi_tls_Dispatch
0000000000000000 D _glapi_tls_Dispatch

The symbol _glapi_tls_Dispatch is defined in, depends to, so why does the link fail?

Does anyone have a clue ?


Did a quick search of libglfw3-dev package and it lists the library file as -lglfw not -lglfw3 on my system. Dunno if that helps or not.

apt-file search libglfw | grep -v doc
libglfw-dev: /usr/lib/x86_64-linux-gnu/libglfw.a
libglfw-dev: /usr/lib/x86_64-linux-gnu/
libglfw-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/libglfw.pc
libglfw2: /usr/lib/x86_64-linux-gnu/
libglfw3: /usr/lib/x86_64-linux-gnu/
libglfw3: /usr/lib/x86_64-linux-gnu/
libglfw3-dev: /usr/lib/x86_64-linux-gnu/

Need Your Help

Detecting Regions Described by Lines on HTML5 Canvas

javascript html5 canvas geometry jcanvas

Start with a 2d grid on an HTML5 canvas. The user creates lines by plotting points - up to 5 lines.

Google map Splitter layout

jquery-ui google-maps layout

Is there is any layout like this