C++ – Why is QMutex unknown

cmutexqt

I've included the QMutex header and using it as seen below. But I get the following error:

error C2146: syntax error : missing > ';' before identifier > '_RecorderParamsMutex'

error C4430: missing type specifier
– int assumed. > Note: C++ does not support default-int

error C4430: missing type specifier -> int assumed. Note: C++ does not > support default-int

#ifndef RECORDERinterface_h
    #define RECORDERinterface_h
    #include "qstring.h"
    #include "ccc.h"
    #include "ddd.h"
    #include <qmutex.h>
    #include "eee.h"

using namespace Common; //for aaaaa

class RecorderInterface{
    //the implemented recorders are my friends, the may access all my private stuff :)
    friend class A;
    friend class B;

public:
    RecorderInterface();     
    bool            setParam(RecorderPrintParam *up);


private:
    QMutex          _RecorderParamsMutex;
};

#endif

Best Answer

Looking at the header file, the class declarations are wrapped by an #ifdef. Try it like this:

#define QT_THREAD_SUPPORT
#include <qmutex.h>

This probably ought to be a project-level #define so other threading definitions are available as well.

Related Topic