PDA

View Full Version : QMutex QMutex::Recursive is not a type name



Qiieha
9th May 2011, 10:38
Hi all !

I have a class, which has a member


QMutex mutex(QMutex::Recursive);

but the compiler says, that QMutex::Recursive is not a type name. But I need the Recursive Mode, cause the default Mode doesn't help me.
QMutex is included.

thx

high_flyer
9th May 2011, 12:56
you can't initialize members with non default constructors like that in a header.
Make your member a pointer, and then initialized it in the implementation file with the recursive mode.

Qiieha
9th May 2011, 15:01
you can't initialize members with non default constructors like that in a header.

thank for your help...I solved the problem without using a pointer.
header file


class Test{
private:
QMutex mx;
public:
Test();
}


cpp file


Test::Test() :
mx(QMutex::Recursive)
{
}