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.
This problem solved itself for me when I installed the development version of eclipse:
Eclipse Luna 4.4 CDT 8.4
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):
with value
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.
You can manually define a
override
macro with no content for the parser only in your Project "Properties/Preprocessor Includes/CDT User Settings".