2014-12-03 71 views
-1

由於某些原因,我的makefile不能編譯。它所說的錯誤在我的頭文件中。標題的constroctor在它應該結束之前結束

Alignment.hh:34:22 error: expected ')' before '&' token 

調用應該是使用引用,這是我在調用此函數時所使用的引用。

這是我Alignment.hh文件

#ifndef encod 
#define encod 
class Encoded   
{ private: 
    Direct &origin; 
    char *subinsertion; 
    int subinsertlen; 
    struct Edit *operation; 
    int editnum;  
    string dname; 
    int dlength;  
    int gaplen; 
    public: 
    Encoded(Alignment &obj); 
    ~Encoded();    
    int getEditNum() const; 
    struct Edit* getOperation() const; 
    int getSubInsertLen() const; 
    char* getSubInsertion() const;; 
    int getDLength() const; 
    string getDName() const; 
    Direct& getOrigin() const; 
    string toString() const; 
    char* getDSeq() const; 
    int getNumDiff(); 
    bool operator<=(Encoded &rightobj)const; 
}; 

class Compressed : public Encoded { 
    private: 
     Encoded encode; 
    public: 
     Compressed(Alignment &obj); 
     bool operator <=(Encoded &rightobj) const; 
}; 
#endif 
+0

您還沒有宣佈'Direct'或'Alignment'。 – juanchopanza 2014-12-03 06:44:04

+0

'class Direct;'添加前向聲明 – Blacktempel 2014-12-03 06:44:55

回答

-1

嘗試編譯這個

#ifndef encod 
#define encod 
class Direct; 
class Alignment; 
class Encoded   
{ private: 
    Direct &origin; 
    char *subinsertion; 
    int subinsertlen; 
    struct Edit *operation; 
    int editnum;  
    string dname; 
    int dlength;  
    int gaplen; 
    public: 
    Encoded(Alignment &obj); 
    ~Encoded();    
    int getEditNum() const; 
    struct Edit* getOperation() const; 
    int getSubInsertLen() const; 
    char* getSubInsertion() const;; 
    int getDLength() const; 
    string getDName() const; 
    Direct& getOrigin() const; 
    string toString() const; 
    char* getDSeq() const; 
    int getNumDiff(); 
    bool operator<=(Encoded &rightobj)const; 
}; 

class Compressed : public Encoded { 
    private: 
     Encoded encode; 
    public: 
     Compressed(Alignment &obj); 
     bool operator <=(Encoded &rightobj) const; 
}; 
#endif 
+0

沒有說明問題<->解決方案,OP應該如何從這樣的答案中學習? – zoska 2014-12-03 09:23:50