1

enter image description here

this happens with both g++ and gcc as whenever I tried gcc file_name and the above happens.

1

Your $GCC_COLORS is probably set up for a light background instead of a dark one.

Check with -fno-diagnostics-colors in your Makefile or whatever build system you use. Bear in mind that build script might be setting that variable.

You could also try running without reverse video and see if it works.

The GCC manual has documentation on the GCC_COLORS environment variable.

2

Your terminal color scheme conflicts with GCC's default colors. That is, black on black is not visible. This is explained in the manual:

The colors are defined by the environment variable GCC_COLORS. Its value is a colon-separated list of capabilities and Select Graphic Rendition (SGR) substrings. SGR commands are interpreted by the terminal or terminal emulator. (See the section in the documentation of your text terminal for permitted values and their meanings as character attributes.) These substring values are integers in decimal representation and can be concatenated with semicolons. Common values to concatenate include 1 for bold, 4 for underline, 5 for blink, 7 for inverse, 39 for default foreground color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color modes foreground colors, 49 for default background color, 40 to 47 for background colors, 100 to 107 for 16-color mode background colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes background colors.

The default GCC_COLORS is error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan, 01;32 is bold green and 01 is bold. Setting GCC_COLORS to the empty string disables colors. Supported capabilities are as follows.

You will be able to modify the environment variable GCC_COLORS to change quote to a different color, something like 01;34. The wikipedia page on ANSI escape codes has more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.