According to some residents of this resource, I installed a look at Code::Block .

I don’t understand how to deal with backlighting between ifdef ? Accordingly, there is a gray text, no matter what is announced and what is not .. it is extremely inconvenient.

An example on which such a picture:

libbuild.h :

 #if ( \ defined(_WIN32) || defined(__WIN32__) || defined(_Windows) || \ defined(_WIN64) || defined(__WIN64__) || \ defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)) # define OS_WIN 1 #endif 

test.c

 #include "libbuild.h" #if defined(OS_WIN) static int aaa(int i) { return (i + 1); } #else static long aaa(long i) { return (i + 1); } #endif 

while always highlighted code long aaa(..) . Naturally, everything is going right, but it is difficult to look. Assembly with this takes place under WIN32 .

here's what it looks like:

enter image description here

There is a solution?

  • Pictures here would be more than appropriate. - αλεχολυτ
  • Specially tried in CodeBlocks . Everything is fine displays. You have OS_WIN declared when building on windows, so there will always be only one option highlighted (if at least one of the macros in the condition is declared). Under Linux, another one will be highlighted. For the sake of experiment, try to comment out #define OS_WIN 1 , will the branch change? - Croessmah
  • @Croessmah, no branch has changed - NewView

1 answer 1

Define lighting depends on two things:

  1. From the settings in the Settings - Editor - General Settings - C / C ++ Editor Settings section:

enter image description here

  1. From the used theme. In the default theme, it looks like this:

enter image description here

Each theme has a setting for items in 2 states: active and inactive. It is possible that the colors you used in the theme you used are unsuccessfully selected for the inactive state, and perhaps you do not have a checkmark, as in the first screenshot.

But there is one important point: for syntax coloring, the current version of C: B does not take into account the defaults in the inclusions. Only those defains that are declared in the same file or in the project settings (Build Options - Compiler Settings - #defines) are perceived.

  • All themes and default settings. I did the same, the tick did not stand only on include host platform defines . I rebuilt, no changes, unfortunately. Perhaps you need to re-create the project when changing glob. settings? or how to update it .. - NewView
  • @NewView Ah, I get it. For syntax coloring, C: B perceives only defines within the same file. If the define is in the header, then the backlight is indeed reversed and highlighted is not what will actually be compiled. When answering the question, I thought that your code is generally highlighted in the same way, in both branches of the Define, and the problem is different. - zed
  • @NewView Accordingly, all that can be advised in this case is to turn off the backlight of the inactive (in C: B opinion) branches by unchecking the checkboxes that are installed on the first screenshot. Then all the branches will be highlighted normally and none of them will be blacked out. - zed
  • :) probably so, thanks for the answer, I understand that there is no solution .. however: (It’s clear about the general illumination, I hoped that there is a way to fix it without turning it off, thanks for the answer. - NewView
  • Add in your answer, and I will mark as correct - NewView