problem with makefile when using threads

Hi people
I have a small program that using the new thread Library that looks like:
http://pastebin.com/h5xvJBjt
I can compile it with using gcc/g++ 4.6.2 on debian using this command:
g++ -std=gnu++0x -pthread trådning.cpp
The program is the working as intended.
But when I use this makefile:
http://pastebin.com/U9wLqC2k
the program crash with fellowing error:
terminate called after throwing an instance of 'std::system_error'
what(): Operation not permitted
Afbrudt (SIGABRT)

Does someone know what I can do to prevent the crash or can guide my in the right direction?
Topic archived. No new replies allowed.