Something weird happening with #ifdef

So I have this code:
1
2
3
4
5
6
void TileButton::draw(Graphics *g)
{
#ifdef DEBUG_TILE_BUTTON
	g->drawRect(rect.x, rect.y, rect.w, rect.h, 0, 0, 0);
#endif
}


And I have this:
1
2
3
4
5
6
void TileSelectButton::draw(Graphics *g)
{
#ifdef DEBUG_TILE_SELECT_BUTTON
	g->drawRect(rect.x, rect.y, rect.w, rect.h, 0, 0, 0);
#endif
}


The TileSelectButton works perfectly fine, but somehow the code within the ifdef block for the TileButton is considered part of the ifdef command, as MS Visual Studio is hightlighting that code slightly in grey. In my main source file I have defined, and only after that I include the file.
1
2
#define DEBUG_TILE_BUTTON
#define DEBUG_TILE_SELECT_BUTTON 


Screenshots of the hightlighting: https://imgur.com/a/35t2m
Last edited on
you should define these sorts of things in the project defined symbols, not in any one file. See if that helps.
It doesn't mean anything. Visual Studio's C++ highlighter runs at a lower refresh rate due to the complexity of parsing C++ code. The highlighter's output at any given moment is not representative of what the compiler will do; sometimes it's best to just ignore it.
I have solved the problem now, thanks both for your help.
Topic archived. No new replies allowed.