0

我收到 C++ 代码错误

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

使用此代码:

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
}

这个错误是什么意思?

4

1 回答 1

7

您忘记了一些分号:

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;    

};
于 2013-09-19T15:17:51.380 回答