Marshall Mathers
Marshall Mathers

Reputation: 75

C++: error: expected ';' before '<' token

I'm getting an error with the C++ code

error: using-declaration for non-member at class scope"
error: expected ';' before '<' token

With this code:

struct Entry { 
    char* word; 
    char* def;
}

class Dictionary { 
    public:
    Dictionary(); 
    ~Dictionary();
    void addEntry(Entry*);
    char* getDef(const char*); 

    private:
    std::vector<Entry> dict;     //Error happens here
}

What does this error mean?

Upvotes: 0

Views: 5150

Answers (1)

Aleph
Aleph

Reputation: 1219

You forgot some semicolons:

struct Entry { 
    char* word; 
    char* def;
};                //C++ structs need a semicolon after the curly brace.


class Dictionary { 
    public:
    Dictionary(); 
    ~Dictionary();
    void addEntry(Entry*);
    char* getDef(const char*); 

    private:
    std::vector<Entry> dict;    

};

Upvotes: 7

Related Questions