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: 1426
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 208 times)
  • Attachment: folded.png
    (Size: 1.47KB, Downloaded 212 times)
Previous Topic:"An error occurred while collecting items to be installed"
Next Topic:Eclipse crashes System
Goto Forum:
  


Current Time: Fri Apr 26 17:41:48 GMT 2024

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

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

Back to the top