class CTest { // other members ..... // declaration static thread_local int m1; } // initialize thread_local int CTest::m1 = 0;