0

I've declared a boolean flag

DEFINE_bool(coolflag, true, "My cool flag.");

and then want to run my binary with coolflag=false:

... --coolflag false

but the value of the flag is still true:

cout << FLAGS_coolflag << endl; // outputs 1

I tried false, False, 0, but the value is still 1 (true).

How can I set coolflag=false?

Alex
  • 579
  • 1
  • 6
  • 14
  • 4
    what is DEFINE_bool ? could you provide minimal, complete example please ? – Gojita Apr 04 '19 at 14:49
  • What do you mean "run your binary"? Shouldn't cflags be *compiler* flags? – nvoigt Apr 04 '19 at 14:50
  • 1
    For command-line arguments, the common practice for double-dash arguments it to use a `=` for the value, as in `--coolflag=false`. If this is true for whatever API you're using I don't know. Perhaps it should be `--no-coolflag` or something else entirely. Have you tried reading the documentation about `DEFINE_bool` and what it expects? – Some programmer dude Apr 04 '19 at 14:54
  • @Someprogrammerdude you're right! It works when I use `--coolflag=false`. – Alex Apr 04 '19 at 14:55

0 Answers0