Eclipse CDT解析器支持C ++ 11? [英] Eclipse CDT parser support for C++11?

查看:467
本文介绍了Eclipse CDT解析器支持C ++ 11?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上使用Eclipse 3.7.2和CDT 8.0.2。如何配置CDT以识别c ++ 11语法,特别是 override ?目前,解析器在所指示的行上标记一个虚假错误。该构建完成没有错误,因为我在编译器命令行中包括-std = c ++ 11。

  class foo 
{
public:
foo(){}
virtual〜foo(){}
virtual void func(){}
};

class bar:public foo
{
public:
bar(){}
virtual〜bar(){}
virtual void func()override {} //< --- parser incorrectly flags syntax error
};

int main()
{
bar my_bar;
return 0;
}

我尝试了 Eclipse wiki 这里没有成功。

解决方案

为了修复C ++,我们只需要编辑器的解析器来识别c ++ 11, +11语法高亮转到:



项目属性 - > C / C ++常规 - >路径和符号 - >符号 - > GNU C ++



并覆盖符号(即添加新符号):

  __ cplusplus 

与值

  201103L 

确保索引器在项目设置中启用( Project - > C / C ++ Index - > Rebuild )。 strong>)



如果问题仍然持续存在reindex。
它现在应该工作。


I'm using Eclipse 3.7.2 with CDT 8.0.2 on Linux. How can I configure the CDT to recognize c++11 syntax, specifically override? Currently the parser flags a bogus error on the line indicated. The build completes without error since I include -std=c++11 in my compiler command lines.

class foo
{
public:
    foo(){}
    virtual ~foo(){}
    virtual void func(){}
};

class bar : public foo
{
public:
    bar(){}
    virtual ~bar(){}
    virtual void func() override {} // <--- parser incorrectly flags syntax error
};

int main()
{
    bar my_bar;
    return 0;
}

I tried the directions on the Eclipse wiki and here without success. Again, I only need the editor's parser to recognize c++11, the actual build is fine.

解决方案

To fix C++11 syntax highlighting go to:

Project Properties --> C/C++ General --> Paths and Symbols --> Symbols --> GNU C++

and overwrite the symbol (i.e. add new symbol):

__cplusplus

with value

201103L

Make sure that indexer is enabled in project settings (C/C++ general --> Indexer)

Then reindex (Project --> C/C++ Index --> Rebuild)

if the problem still persist reindex once again. It should work now.

这篇关于Eclipse CDT解析器支持C ++ 11?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆