Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #123766 > unrolled thread

g++: What command line option allow me to get the most friendly/responsive compiling error message?

Started by🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl>
First post2026-04-27 17:27 +0200
Last post2026-04-27 17:28 -0400
Articles 6 — 4 participants

Back to article view | Back to comp.lang.c++


Contents

  g++: What command line option allow me to get the most friendly/responsive compiling error message? 🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> - 2026-04-27 17:27 +0200
    Re: g++: What command line option allow me to get the most friendly/responsive compiling error message? Michael S <already5chosen@yahoo.com> - 2026-04-27 18:43 +0300
    Re: g++: What command line option allow me to get the most friendly/responsive compiling error message? 🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> - 2026-04-27 18:20 +0200
      Re: g++: What command line option allow me to get the most friendly/responsive compiling error message? Michael S <already5chosen@yahoo.com> - 2026-04-27 19:29 +0300
      Re: g++: What command line option allow me to get the most friendly/responsive compiling error message? scott@slp53.sl.home (Scott Lurndal) - 2026-04-27 18:53 +0000
    Re: g++: What command line option allow me to get the most friendly/responsive compiling error message? James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-04-27 17:28 -0400

#123766 — g++: What command line option allow me to get the most friendly/responsive compiling error message?

From🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl>
Date2026-04-27 17:27 +0200
Subjectg++: What command line option allow me to get the most friendly/responsive compiling error message?
Message-ID<p-SdnWKejLjAHXL0nZ2dnZfqn_GdnZ2d@giganews.com>
Hello!

What g++ command line option allow me to get the most 
friendly/responsive compiling error message? I use:

-Wformat=2

which is not very friendly.

-- 
Have a nice day!
Jacek Marcin Jaworski,  Pruszcz Gd., woj. Pomorskie, Polska 🇵🇱, EU 🇪🇺;
tel.: +48-609-170-742,   najlepiej w godz.: 5:00-5:55 lub 16:00-17:25;
<jmj@energokod.gda.pl>, gpg: 4A541AA7A6E872318B85D7F6A651CC39244B0BFA;
Domowa s. WWW:                             <https://energokod.gda.pl>;
Mini Netykieta:         <https://energokod.gda.pl/MiniNetykieta.html>;
Mailowa Samoobrona:             <https://emailselfdefense.fsf.org/pl>.
UWAGA:
NIE ZACIĄGAJ "UKRYTEGO DŁUGU"! PŁAĆ ZA PROG. FOSS I INFO. INTERNETOWE!
CZYTAJ DARMOWY: "17. Raport Totaliztyczny - Patroni Kontra Bankierzy":
<https://energokod.gda.pl/raporty-totaliztyczne/17.%20Patroni%20Kontra%20Bankierzy.pdf>

[toc] | [next] | [standalone]


#123767

FromMichael S <already5chosen@yahoo.com>
Date2026-04-27 18:43 +0300
Message-ID<20260427184333.00000cae@yahoo.com>
In reply to#123766
On Mon, 27 Apr 2026 17:27:44 +0200
🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> wrote:

> Hello!
> 
> What g++ command line option allow me to get the most 
> friendly/responsive compiling error message? I use:
> 
> -Wformat=2
> 
> which is not very friendly.
> 

Friendly is in the eye of beholder.

Responsive? That I don't understand at all. What exactly do you mean by
that?

-Wformat=2 influences warnings related to format specifiers in printf
family. It has no effect on the rest of the warnings and certainly has
no effect on error messages.

BTW, docs are here:
https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Warning-Options.html

[toc] | [prev] | [next] | [standalone]


#123769

From🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl>
Date2026-04-27 18:20 +0200
Message-ID<xOadnRlxOfB-EXL0nZ2dnZfqn_ZWuUQd@giganews.com>
In reply to#123766
W dniu 27.04.2026 o 17:27, 🇵🇱Jacek Marcin Jaworski🇵🇱 pisze:
> Hello!
> 
> What g++ command line option allow me to get the most 
> friendly/responsive compiling error message? I use:
> 
> -Wformat=2
> 
> which is not very friendly.

In the middle time I ask ChatGPT, and it give me some advises:

-fdiagnostics-color=always -fdiagnostics-show-caret 
-fdiagnostics-show-option -fdiagnostics-show-template-tree -fmax-errors=5

, but is this optimal?

-- 
Jacek Marcin Jaworski,  Pruszcz Gd., woj. Pomorskie, Polska 🇵🇱, EU 🇪🇺;
tel.: +48-609-170-742,   najlepiej w godz.: 5:00-5:55 lub 16:00-17:25;
<jmj@energokod.gda.pl>, gpg: 4A541AA7A6E872318B85D7F6A651CC39244B0BFA;
Domowa s. WWW:                             <https://energokod.gda.pl>;
Mini Netykieta:         <https://energokod.gda.pl/MiniNetykieta.html>;
Mailowa Samoobrona:             <https://emailselfdefense.fsf.org/pl>.
UWAGA:
NIE ZACIĄGAJ "UKRYTEGO DŁUGU"! PŁAĆ ZA PROG. FOSS I INFO. INTERNETOWE!
CZYTAJ DARMOWY: "17. Raport Totaliztyczny - Patroni Kontra Bankierzy":
<https://energokod.gda.pl/raporty-totaliztyczne/17.%20Patroni%20Kontra%20Bankierzy.pdf>

[toc] | [prev] | [next] | [standalone]


#123770

FromMichael S <already5chosen@yahoo.com>
Date2026-04-27 19:29 +0300
Message-ID<20260427192949.000027bf@yahoo.com>
In reply to#123769
On Mon, 27 Apr 2026 18:20:09 +0200
🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> wrote:

> W dniu 27.04.2026 o 17:27, 🇵🇱Jacek Marcin Jaworski🇵🇱 pisze:
> > Hello!
> > 
> > What g++ command line option allow me to get the most 
> > friendly/responsive compiling error message? I use:
> > 
> > -Wformat=2
> > 
> > which is not very friendly.  
> 
> In the middle time I ask ChatGPT, and it give me some advises:
> 
> -fdiagnostics-color=always -fdiagnostics-show-caret 
> -fdiagnostics-show-option -fdiagnostics-show-template-tree
> -fmax-errors=5
> 
> , but is this optimal?
> 

Your questions are impossible to answer before you explain to us what do
you want.
And no, "friendly", "responsive" and "optimal" are not explanations.

The best use of chat bot would be to ask it to translate your very
detailed wishes from Polish to English. Then ask it translate back from
English to Polish, fix parts you are not happy about and repeat this
loop until satisfied.
Then come here with last translated variant.


[toc] | [prev] | [next] | [standalone]


#123772

Fromscott@slp53.sl.home (Scott Lurndal)
Date2026-04-27 18:53 +0000
Message-ID<QgOHR.449956$JFP5.267572@fx13.iad>
In reply to#123769
=?UTF-8?B?8J+HtfCfh7FKYWNlayBNYXJjaW4gSmF3b3Jza2nwn4e18J+HsQ==?= <jmj@energokod.gda.pl> writes:
>W dniu 27.04.2026 o 17:27, 🇵🇱Jacek Marcin Jaworski🇵🇱 pisze:
>> Hello!
>> 
>> What g++ command line option allow me to get the most 
>> friendly/responsive compiling error message? I use:
>> 
>> -Wformat=2
>> 
>> which is not very friendly.
>
>In the middle time I ask ChatGPT, and it give me some advises:
>
>-fdiagnostics-color=always -fdiagnostics-show-caret 
>-fdiagnostics-show-option -fdiagnostics-show-template-tree -fmax-errors=5
>
>, but is this optimal?

Optimal is the set of options that reduce the number of
lines of diagnostic per detected syntax error to exactly one.

Every release, gcc gets more verbose, and multiple
diagnostic lines per error are very annoying.

CFLAGS += -fno-diagnostics-show-caret
CFLAGS += -fno-diagnostics-show-option

at a minimum.

I prefer -Wformat=1, to avoid spurious warnings when the
format string is not a string constant, yet is completely under
control of the application (I.e. not dependent upon
any input from the end-user).

YMMV.

[toc] | [prev] | [next] | [standalone]


#123774

FromJames Kuyper <jameskuyper@alumni.caltech.edu>
Date2026-04-27 17:28 -0400
Message-ID<10sokd9$2mn6k$1@dont-email.me>
In reply to#123766
On 2026-04-27 11:27, 🇵🇱Jacek Marcin Jaworski🇵🇱 wrote:
> Hello!
>
> What g++ command line option allow me to get the most
> friendly/responsive compiling error message? I use:
>
> -Wformat=2
>
> which is not very friendly.

That is a highly subjective opinion. You'll get different answers from
different people. In general, each person's answer is "right" for that
person, but not necessarily for anyone else. I normally build using
make, which looks for and uses an environment variable named CXXFLAGS
when compiling C++ code, and I've got CXXFLAGS set to:

-std=c++23 -pedantic -Wall -O2 -Wpointer-arith -Wcast-align
-fno-enforce-eh-specs -fno-gnu-keywords -fno-nonansi-builtins
-Wctor-dtor-privacy -Wnon-virtual-dtor -Wold-style-cast
-Woverloaded-virtual -Wsign-promo

I guarantee you that my posting that list of options will cause many
people to disagree - whether they'll bother saying so, I don't know.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web