Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Hide precompiler instructions in c/c++ files
Hide precompiler instructions in c/c++ files [message #1792167] Thu, 12 July 2018 09:43 Go to next message
Thomas Leber is currently offline Thomas LeberFriend
Messages: 1
Registered: July 2018
Junior Member
Hi,

is there any way to hide all precompiler instruction but only show included code?

Something like this:


#define OPTION1 ENABLED
#define OPTION2 

typedef unsigned char uint8;
typedef unsigned long uint32;

int function(int num) {

    switch (num)
    {
        #if (OPTION1 == ENABLED)
        case 1:
        num+1;
        break;
        #endif

        #if (OPTION2 == ENABLED)
        case 2:
        num+2;
        break;
        #endif

        default:
        break;
    }

    return num;
}


would show like this:

#define OPTION1 ENABLED
#define OPTION2 

typedef unsigned char uint8;
typedef unsigned long uint32;

int function(int num) {

    switch (num)
    {
        case 1:
        num+1;
        break;

        default:
        break;
    }

    return num;
}
Re: Hide precompiler instructions in c/c++ files [message #1792282 is a reply to message #1792167] Sat, 14 July 2018 03:49 Go to previous message
David VavraFriend
Messages: 803
Registered: October 2012
Senior Member
It's called code folding.
The code is not completely hidden.

Go to Window --> Preferences --> C/C++ --> Editor --> Folding
to select and modify it.

Example when unfolded
index.php/fa/33396/0/

when folded (click on the circled '-' sign in the margin)
index.php/fa/33397/0/
  • Attachment: unfolded.png
    (Size: 5.03KB, Downloaded 53 times)
  • Attachment: folded.png
    (Size: 1.47KB, Downloaded 48 times)
Previous Topic:GDB Error
Next Topic:Serial Terminal
Goto Forum:
  


Current Time: Thu Nov 15 01:43:22 GMT 2018

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

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

Back to the top