I have a stripped down simple program with a static variable (\'abc.cpp\'):
#include int main(int, char**) { static const std::string a(\
$ man gcc
is your friend. There is more to using the threading library than just including the library in the linking step: the files should be compiled using the "-pthread" switch too.