2013-06-30 2 views
0

그래서 uni 프로젝트를하고 있습니다. 컴파일을 시도 할 때 이상한 오류가 나타납니다. 순환 종속성에서 읽은 것일 수도 있지만 확인하지 않았습니다. 이다C++ 존재하지 않는 행에 컴파일 오류가 발생했습니다.

#ifndef __ScheduleHeader_H_INCLUDED__ 
#define __ScheduleHeader_H_INCLUDED__ 

#include "TrainStationHeader.h" 

class Schedule 
{ 
friend class ScheduleIterator; 
    public: 
    //get data functions 
    std::string getFromCity() { return fromCity; } 
    std::string getToCity() { return toCity; } 
    std::string getTrainID() { return trainID; } 
    std::string getDate(); 
    std::string getTime(); 
    std::string getTimeForTickets(); 
    std::string getPrice() { return price; }  

    //set data functions + validation on the input data 
    bool setFromCity(); 
    bool setToCity(); 
void setDate(); 
    void setTime(); 
    bool setTrainID(); 
    void setPrice(); 

    std::string createScheduleLine(); 

private: 
    int validateDate(struct tm,struct tm); 
    int validateTime(struct tm,struct tm); 

    std::string scheduleFileName; 
    std::string fromCity; 
    std::string toCity; 
    struct tm dateAndTime; 
    std::string trainID; 
    std::string price; 
}; 

#endif 

내가 컴파일 할 때 내가 private.The 오류와 같은 다른 클래스의 일정 개체가 있기 때문에 내가 친구를 추가했습니다 :

c:\program files (x86)\windows kits\8.0\include\um\schedule.h(60): error C2146: syntax   error : missing ';' before identifier 'Type' 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(60): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(61): error C2146: syntax error : missing ';' before identifier 'Offset' 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(61): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(68): error C2146: syntax error : missing ';' before identifier 'Size' 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(68): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(69): error C2146: syntax error : missing ';' before identifier 'Bandwidth' 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(70): error C2146: syntax error : missing ';' before identifier 'NumberOfSchedules' 
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(70): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 

PS : 문제는 여기에 헤더 코드의 난 ' MC VS 2012를 사용하는 경우

#ifndef __TrainStation_H_INCLUDED__ 
#define __TrainStation_H_INCLUDED__ 

#include <iostream> 
#include <string> 
#include <fstream> 
#include <locale> 
#include <iomanip> 
#include <ctime> 
#include <cstdio> 
#include <vector> 

std::string removeWhiteSpace(std::string a); 

//Resieves the file on wich to operate upon and what to search for. 
//If it finds it it returns the line on wich it has been found ,if not returns -1 
int checkContent(std::string FileName, std::string target); 

//Give the Function the File Name with wich you would like to work and the target that    you would like to delete 
//It works by copying everything exept the target string to another file then renames it and deletes the old file 
int deleteContent(std::string File,std::string target); 

void renameFile(std::string , std::string); 

bool checkFileState(std::ifstream &file); 
#endif 
+3

'TrainStationHeader.h'헤더 파일에 세미콜론이나 누락 된 부분이 없습니까? –

+0

아니, 괜찮아요. 여러 파일에서 잘 작동 했었고 그 파일을 만지지 못했습니다. –

+0

포함 경로를 확인해야합니다. 포함하는 파일이 실제로 표시되어 있습니까? 오류 메시지를 확인하면 질문에 표시되는 파일에없는 것에 대해 불만을 제기합니다. –

답변

0

오류 메시지가 C "에서 오류를 나타냅니다 :여기 TrainStation.h, 내가 클래스의 대부분 (내가 그것을 가장 좋은 방법이 아니다 알고)에 걸쳐 사용하는 함수와 라이브러리의 그것의 단지 무리의 \ VS 또는 추가 SDK 설치의 일부인 프로그램 파일 (x86) \ windows kits \ 8.0 \ include \ um \ schedule.h " 완전히 다른 헤더 파일을 인용합니다.

오류를 알 수없는 경우 전 처리기 출력을 요청하고 문제를 확인하십시오./SHOWINCLUDES도 도움이 될 수 있습니다.

+0

문제는 내가 내 티켓 file.Once에 잘못된 헤더를 포함 시켰습니다 내가 dorectory에 가서 schedule.h를 삭제 삭제 오류가 분명 해졌다 –

관련 문제