tags:

views:

148

answers:

3

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
A: 

missing namespace? I am not familiar with QMutex, but if it comes with some library it is expected to be defined withing the library's namespace. Unless it is "Common".

davka
+3  A: 

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.

Hans Passant
+2  A: 

Which version of Qt are you using? From your header style it looks like Qt3

"Earlier versions of Qt offered an option to build the library without thread support. Since Qt 4.0, threads are always enabled." [source]

Are you sure you have thread support built into the library?

Bill
yes I'm using QT 3.3
Christoferw