【发布时间】:2011-01-07 06:22:34
【问题描述】:
我已包含 QMutex 标头并使用它,如下所示。但我收到以下错误:
错误 C2146:语法错误:缺少 > ';'在标识符之前 > '_RecorderParamsMutex'
错误 C4430:缺少类型说明符 - int 假定。 > 注意:C++ 不支持 default-int
错误 C4430:缺少类型说明符 -> 假定为 int。注意:C++ 不 > 支持 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
【问题讨论】:
-
不回答您的问题,但像 _RecorderParamsMutex(以下划线和大写字母开头的名称)这样的名称是为 C++ 实现保留的 - 您不得在自己的代码中创建此类名称。
-
好的,谢谢,您有该标准的链接吗?因此,我可以进一步了解该命名标准。
-
该标准无法在线获得——您必须为此付费。不过有各种各样的草稿。
-
我提供的代码编译正确吗?
-
我以同样的方式在其他文件中使用 qmutex,它可以工作。在我目前的项目中很难测试这一点,我不能去掉这么多(上面的代码仍然被去掉以便在这里发布)