2010-01-20 7 views
0

QMutex 헤더를 포함하고 아래에 표시된대로 사용했습니다.QMutex가 알려지지 않은 이유는 무엇입니까?

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 
+2

질문에 답변하지 않지만 _RecorderParamsMutex (밑줄과 대문자로 시작하는 이름)는 C++ 구현을 위해 예약되어 있으므로 사용자 코드에서 이러한 이름을 만들 수 없습니다. –

+0

그래, 고마워, 그 표준에 대한 링크가 있니? 그래서 나는 그 명명 표준을 자세히 살펴볼 수있다. – Christoferw

+0

온라인에서 표준을 사용할 수 없으므로 비용을 지불해야합니다. 약 두드리는 초안이 있습니다. –

답변

3

header file에서 보면 클래스 선언은 #ifdef로 래핑됩니다. 이것을 다음과 같이 시도하십시오 :

#define QT_THREAD_SUPPORT 
#include <qmutex.h> 

이것은 아마도 프로젝트 수준 #define이어야하므로 다른 스레딩 정의도 사용할 수 있습니다.

0

없는 네임 스페이스 :하지만 다음과 같은 오류가? QMutex에 익숙하지 않지만 라이브러리가 있으면 해당 라이브러리의 네임 스페이스로 정의해야합니다. 그것이 "공통"이 아닌 한.

2

어떤 버전의 Qt를 사용하고 있습니까? 헤더 스타일에서 Qt3처럼 보입니다

"이전 버전의 Qt는 스레드 지원없이 라이브러리를 빌드 할 수있는 옵션을 제공했습니다 .Qt 4.0 이후 스레드는 항상 사용 가능합니다." [source]

정말 라이브러리에 스레드 지원 기능이 내장되어 있습니까?

+0

예 QT 3.3을 사용하고 있습니다. – Christoferw

관련 문제