简体   繁体   English

C ++:错误:预期为';' 在“ <”令牌之前

[英]C++: error: expected ';' before '<' token

I'm getting an error with the C++ code 我的C ++代码出现错误

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? 这个错误是什么意思?

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;    

};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM