Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse/CDT editor not picking up project-defined symbols in coloring ifdef'ed out sections

The problem I'm seeing is that under preferences, C/C++ Defined symbols for different Configurations/targets aren't showing up in the code coloring.

When I change the active build configuration in the project menu, I would expect the editor & code coloring to pick up the symbols from the project settings, but it only seems to be picking up the symbols for one of the targets.

Is there any way to have the code coloring for ifdef'ed code follow the active build configuration?

like image 755
Guy Avatar asked Jun 01 '10 17:06

Guy


3 Answers

I solved this problem on my system by setting 'Window->Preferences->C/C++->Indexer->Use active build configuration'

like image 117
user443923 Avatar answered Nov 20 '22 12:11

user443923


In response to phord's comment. After changing the indexer setting to "Use Active Configuration" you need to change the active conf of the project to something else and then back. Then it picks up the changes.

like image 36
Johan Avatar answered Nov 20 '22 13:11

Johan


just a small addition to the symbols option: give it value 1

what worked for me is this:

  • copy the define name to clipboard(lets say we have: #ifdef DBG_TYP_1)
  • select the project in project explorer
  • go to - Project->Properties->C/C++ General->Path and Symbols
  • in the "# Symbols" tab
  • add symbol DBG_TYP_1 with value 1

thanks for the tips !

like image 2
ozma Avatar answered Nov 20 '22 12:11

ozma