Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt foreach is giving me sytax error highlight in Eclipse

Tags:

c++

eclipse

qt

Qt foreach is giving me sytax error highlight in Eclipse.

I'm programming in C++ using a Qt framework.

I use Eclipse SDK (3.5.2) as my text editor / IDE.

I compile in a console outside of Eclipse using GCC.

When I'm editing my files in Eclipse, I find that Qt's "foreach" is highlighting as a syntax error.

Does anyone know how to fix this? It's not majorly important or anything but it's starting to annoy me. It's as though it's not recognizing the command or something...

like image 443
Wes Avatar asked Nov 14 '22 07:11

Wes


1 Answers

If you've enable c++11 support in Eclipse you can redefine 'foreach' to be a range based for loop. In the project properties, select 'Paths and Symbols' in the left pane, then select the 'Symbols' tab. Add a new symbol with 'Name'= foreach(a,b) 'Value'=for(a:b) Select 'Add to all configurations' and 'Add to all languages'

like image 152
Steven Avatar answered Nov 16 '22 02:11

Steven