2015-10-13 2 views
1

Когда я пытаюсь скомпилировать я получаю ошибку:Проблема с несколькими типами в одной декларации

In file included from editorMain.cpp:2:0: 
EditorList.h:40:2: error: multiple types in one declaration 
}; 
^
In file included from EditorList.cpp:4:0: 
EditorList.h:40:2: error: multiple types in one declaration 
}; 
^
EditorList.h:40:2: error: multiple types in one declaration 
}; 
^

Ошибка находится где-то в этом:

#ifndef EDITORLIST_H 
#define EDITORLIST_H 

#include <cstdlib> 
#include <iostream> 
#include <string> 
using namespace std; 

class EditorList 

class Node 
{ 
    friend class EditorList; 
    private: 
    Node *nextNode; 
    int lineNum; 
    string lineText; 

    public: 
    Node(void) 
    : nextNode(NULL) 
    {} 

    Node(int val) 
    : lineNum(val), nextNode(NULL) 
    {} 

    Node(int val, Node* next) 
    : lineNum(val), nextNode(next) 
    {} 

    int getLine(void) 
    {return lineNum;} 

    string getText(void) 
    {return lineText;} 

    Node* getNext(void) 
    {return nextNode;} 
}; 

class EditorList 
{ 
    private: 
    Node *head; 
    Node *tail; 

    public: 
    EditorList(void); 
    EditorList(int val); 
    //-EditorList(void); 

    void insertHead(int val); 
    void insertInside(Node* inptr, int val); 
    void insertEnd (int); 
    Node* getNode(int pos); 
    void deleteLine (int); 
    void printText(); 
    void displayMenu(); 
    void saveQuit(); 
}; 

#endif /* EDITORLIST_H */ 

Я действительно не уверен, что является причиной этого так как единственный раз, когда я видел эту ошибку, я забыл о двоеточии после определения класса, но, похоже, это не так. Любая помощь приветствуется.

+0

[OT]: 'с помощью патезрасе,' это плохая идея, даже больше в заголовке. – Jarod42

ответ

1

не 100% уверен, но я считаю, вам нужно; после объявления класса вперед.

using namespace std; 

class EditorList 

class Node 

Если вероятно

using namespace std; 

class EditorList; 

class Node 
1

пропавших без вести с запятой после EditorList вперед декларации

Смежные вопросы