
Deane Yang wrote:
I'm using the program options library to parse both command-line and configuration file parameters. I'd like to know how to find command-line arguments that are *not* registered and therefore not recognized by the parser. I want to be able to print a warning message like "Following arguments were ignored:....".
I did it like that: // assume that options is a std::vectorstd::string containing // the passed options (argv[]) po::options_description desc; // contains the options your prog supports po::variables_map vm; po::command_line_parser parser(options).allow_unregistered().options(desc); po::parsed_options parsed = parser.run(); po::store(parsed, vm); po::notify(vm); // recognized options std::vectorstd::string unrecognizedOptions = po::collect_unrecognized(parsed.options, po::include_positional); This is documented at doc/html/program_options/howto.html#id3458178 in your Boost docs. Best regards Christoph