Opened 12 years ago

Closed 12 years ago

#4541 closed Bugs (duplicate)

Options starting with "opt_" not recognized by command line parser

Reported by: Peter Hepperger <hepperger@…> Owned by: Vladimir Prus
Milestone: Component: program_options
Version: Boost 1.43.0 Severity: Problem
Keywords: Cc:

Description

Hello,

I have a strange problem when using boost::program_options. Options whose name starts with "opt_" seem to be ignored by the command line parser. I tried to declare an option of type string with name "opt_method". If I enter the command line parameter --opt_method='foo', the option value 'foo' is not present afterwards (the value is still equal to the default value, if any is declared). The parameter is read correctly when using a configuration file, however.

Moreover, if I do NOT declare an option with this name, but still enter the command line parameter, there is no boost::program_options::unknown_option exception thrown. As soon as I change the name of the option to "optmethod" or "method", the problems are gone.

Best regards, Peter

Change History (2)

comment:1 by Peter Hepperger <hepperger@…>, 12 years ago

Another test showed that this is due to the bug described in ticket/545 (I had second option starting with "opt_"). Hence, this is probably already fixed in the trunk version of boost.

comment:2 by Peter Hepperger <hepperger@…>, 12 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.