"C2143 : 구문 오류 : 누락되었습니다 ';' '*'Track.h 에서 전에이가 "실종"클래스 정의로 인해 생각알 수없는 클래스입니까? C2143 구문 오류 : 누락 된 ";" before '*'
을 이들은 3 헤더 파일은 다음과 같습니다.
Topics.h, 패키지 레벨의 헤더 파일 # 포함 다른 모든 것들 :
#ifndef Topics_H
#define Topics_H
#include <oxf\oxf.h>
#include "Request.h"
#include "TDPoint.h"
#include "Track.h"
#include "TrackReport.h"
#endif
그리고 단순히 3 개 긴 속성을 가진 클래스를 정의 ("3DPoint"에서와 같이) TDPoint, 거기 :
#ifndef TDPoint_H
#define TDPoint_H
#include <oxf\oxf.h> // Just IBM Rational Rhapsody's Framework
#include "Topics.h"
class TDPoint {
//// Constructors and destructors ////
public :
TDPoint();
~TDPoint();
//// Additional operations ////
long getX() const;
void setX(long p_x);
long getY() const;
void setY(long p_y);
long getZ() const;
void setZ(long p_z);
//// Attributes ////
protected :
long x;
long y;
long z;};
#endif
그러나 문제의 리 표시된 라인, 여기 말이지 :
#ifndef Track_H
#define Track_H
#include <oxf\oxf.h> // Just IBM Rational Rhapsody's Framework
#include "Topics.h"
#include "TDPoint.h"
class Track {
public :
//// Operations ////
std::string getId() const;
void setId(std::string p_id);
TDPoint* getPosition() const; // <--- This line, the first line to use TDPoint, throws the error
//// Attributes ////
protected :
std::string id;
TDPoint position;
public :
Track();
~Track();
};
#endif
내 생각 엔 컴파일러 (MS VS2008/MSVC9가) 단순히 클래스 몰랐다 그러나 심지어 "와 같은 헤더 파일에 클래스를 정의하는 것이 었습니다"TDPoint을. " Track "을 사용하거나"class TDPoint "와 같은 전달 선언을 사용하면 (undefined class : 오류가 발생 함) 도움이되지 않습니다. 코드가 Rhapsody에서 자동 생성되었으므로 차이가 발생합니다.
하지만 오류가 완전히 다른 것일 수 있습니까?
당신은'void setId (std :: string p_id);'를 가지고 있지만''에 대한 포함을 보지 못했습니다. –
StoryTeller