Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How do I change highlighting of C++ preprocessor directives?
icon5.gif  How do I change highlighting of C++ preprocessor directives? [message #758631] Thu, 24 November 2011 00:31 Go to next message
Arman  is currently offline Arman Friend
Messages: 15
Registered: November 2011
Junior Member
Ok so suppose I have this:

#define MYDIRECTIVE

#ifdef MYDIRECTIVE
bool myswitch = 1;
#else
bool myswitch = 0;


Eclipse will go ahead and white out the bottom half of that if statement (because MYDIRECTIVE is defined), which is fine, but I'd like to change the color of that highlighting. I initially thought to look here: Windows->Preferences->C/C++->Editor->Syntax Coloring->Preprocessor

However, all I find there is how to change the coloring of the preprocessor text, not the highlighting. Any ideas? I'm using Eclipse 3.7.0 with the eclipse color theme plugin v0.11.0, running on ubuntu.

[Updated on: Fri, 25 November 2011 04:37]

Report message to a moderator

Re: How do I change highlighting of C++ preprocessor directives? [message #764817 is a reply to message #758631] Mon, 12 December 2011 22:37 Go to previous messageGo to next message
Michael  is currently offline Michael Friend
Messages: 1
Registered: December 2011
Location: Portland, OR
Junior Member
For CDT, I've found this in Windows > Preferences > C/C++ > Editor. In the list of "Appearance Color Options" you'll find the "Inactive Code Highlight" sets the value for disabled code. In the example you presented above, the last 2 lines would be highlighted by this color.
Re: How do I change highlighting of C++ preprocessor directives? [message #767873 is a reply to message #764817] Mon, 19 December 2011 05:45 Go to previous messageGo to next message
Arman  is currently offline Arman Friend
Messages: 15
Registered: November 2011
Junior Member
Great, thanks for this Smile
Re: How do I change highlighting of C++ preprocessor directives? [message #1727472 is a reply to message #764817] Wed, 23 March 2016 09:53 Go to previous messageGo to next message
Harald-R. Flasch is currently offline Harald-R. FlaschFriend
Messages: 6
Registered: March 2016
Junior Member
Exists there a way to just "gray-out" disabled code like VS?

Re: How do I change highlighting of C++ preprocessor directives? [message #1727532 is a reply to message #1727472] Wed, 23 March 2016 14:31 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 03/23/2016 03:53 AM, Harald-R. Flasch wrote:
> Exists there a way to just "gray-out" disabled code like VS?

Since this is for C/C++, you might get better help in the Eclipse CDT
forum. Different languages have their own editors in Eclipse.
Re: How do I change highlighting of C++ preprocessor directives? [message #1727538 is a reply to message #1727532] Wed, 23 March 2016 15:27 Go to previous message
Harald-R. Flasch is currently offline Harald-R. FlaschFriend
Messages: 6
Registered: March 2016
Junior Member
Thank you for your reply. I am (more or less) new to Eclipse ... Using Mars.1 and C/C++ GCC project.

EDIT:
"Eclipse CDT" is part of the bundle we've installed.

[Updated on: Thu, 24 March 2016 13:51]

Report message to a moderator

Previous Topic:What does "exclamation mark" (!) mean on xubuntu eviroment? Eclipse program.
Next Topic:How to start a plugin by an event trigger
Goto Forum:
  


Current Time: Fri Apr 19 00:15:16 GMT 2024

Powered by FUDForum. Page generated in 0.03449 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top