Opened 10 years ago

Last modified 9 years ago

#7256 new Bugs

wrong error message for program options with dashes

Reported by: thomas.zuhl@… Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc: mail@…

Description

Hi, I defined some options:

optionsDescription.add_options()
     ....
    ("output-file,o", program_options::value<std::string>(), "Result file")
     ....;

Now, when I start my program without an argument (e.g. ./myprog -o) the error message says:

the required argument for option '--file' is missing

instead of

the required argument for option '--output-file' is missing

This worked at least with version 1.48.

Attachments (1)

minipo.cc (680 bytes ) - added by Georg Sauthoff <mail@…> 9 years ago.
minimal example

Download all attachments as: .zip

Change History (2)

comment:1 by Georg Sauthoff <mail@…>, 9 years ago

Cc: mail@… added
Version: Boost 1.50.0Boost 1.53.0

I can reproduce this issue with boost 1.53.

Using a small example (cf. attachment):

./minipo --foo-1 dd 
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value> >'
  what():  the argument ('dd') for option '--1' is invalid

Where the options are defined as:

./minipo --help    
Options:
  --help                this help screen
  --foo-1 arg           foo
  --bar-2 arg           bar

by Georg Sauthoff <mail@…>, 9 years ago

Attachment: minipo.cc added

minimal example

Note: See TracTickets for help on using tickets.