Re: [Boost-users] Unknown program_options bomb
Will, I've changed my original po::store(parse_command_line(argc, argv, desc), vm); to po::store(po::command_line_parser(argc, argv). options(desc). positional(pd). run(), vm); where desc is is an options_description and pd is a positional_options_description. This looks like an exact match for po::variables_map vm; po::store(po::command_line_parser(ac, av). options(desc).positional(p).run(), vm); po::notify(vm); which is the example from http://www.boost.org/doc/html/program_options/tutorial.html. However, the code still bombs if I give it a positional parameter or an option it isn't expecting. Merrill
Hi Merrill, first of all, please configure your mail (or news client) to: - preserve threads - do line wrapping Both issue makes reading a bit harder.
po::variables_map vm; po::store(po::command_line_parser(ac, av). options(desc).positional(p).run(), vm); po::notify(vm);
which is the example from http://www.boost.org/doc/html/program_options/tutorial.html. However, the code still bombs if I give it a positional parameter or an option it isn't expecting.
"bombs" is fairly inexact. You mean your monitor explodes? Or something else? Please - specify the exact behaviour you see - provide minimal complete example which exposes the behaviour The expected behaviour on unknown options is to throw an exception. Do you have a "catch" statement? - Volodya
participants (2)
-
Merrill Cornish
-
Vladimir Prus