0
votes

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
3
Not to answer your question, but names like _RecorderParamsMutex (ones that begin with an underscore and an uppercase letter) are reserved for the C++ implementation - you are not allowed to create such names in your own code.anon
ok thanks, have you a link to that standard? So I can take a further look at that naming standard.Christoferw
The standard isn't available on line - you have to pay for it. There are various drafts knocking about though.anon
Does the code i provided compile correctly ?Benoît
i use the qmutex in other files the same way, and it works. its hard to test this in my current proejct, i can't strip out so much (the code above is still stripped for posting here)Christoferw

3 Answers

3
votes

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.

2
votes

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?

0
votes

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".