我已经包含了QMutex头并使用它,如下所示。但我得到了以下错误:
错误C2146:语法错误:缺少> ';‘之前的标识符> '_RecorderParamsMutex’ 错误C4430:缺少类型说明符- int假设。>注意: C++不支持默认-int 错误C4430:缺少类型说明符-> int假设。注意: C++不支持默认-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发布于 2010-01-20 13:24:07
查看头文件,类声明由一个#ifdef包装。试着这样做:
#define QT_THREAD_SUPPORT
#include <qmutex.h>这可能应该是一个项目级别的# definitions,因此其他线程定义也是可用的。
发布于 2010-01-20 15:26:24
您使用的是哪种版本的Qt?从标题样式看,它看起来像Qt3
“早期版本的Qt提供了一个不支持线程的构建库的选项。从QT4.0开始,线程总是被启用的。”[来源]。
您确定库中内置了线程支持吗?
发布于 2010-01-20 13:22:29
缺少命名空间?我不太熟悉QMutex,但是如果它附带了一些库,那么它应该是通过库的命名空间来定义的。除非是“共同”。
https://stackoverflow.com/questions/2101362
复制相似问题