1

I have been working on a learning project in C++(11) and I want to implement something analogous to -

class ImpClass
{
    static __thread Foo foo;

    void doSomething()
    {
        ImpClass::foo.doSomeOtherThing();
        // do something;
    }
};

But compiling this results into undefined reference to 'ImpClass::foo[abi:cxx11]'

when using thread_local instead of __thread, it says undefined reference to 'TLS init function for ImpClass::foo[abi:cxx11]'.

I am using gcc compiler (version : 9.3.0)

Nitesh Meena
  • 53
  • 1
  • 5

0 Answers0