首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >C++:错误:'<‘标记前应为';’

C++:错误:'<‘标记前应为';’
EN

Stack Overflow用户
提问于 2013-09-19 23:16:36
回答 1查看 4.7K关注 0票数 0

我收到一个关于C++代码的错误

代码语言:javascript
复制
error: using-declaration for non-member at class scope"
error: expected ';' before '<' token

使用以下代码:

代码语言:javascript
复制
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
}

这个错误是什么意思?

EN

回答 1

Stack Overflow用户

发布于 2013-09-19 23:17:51

您忘记了一些分号:

代码语言:javascript
复制
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;    

};
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18898608

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档