Boost logo

Boost :

From: Neal D. Becker (nbecker_at_[hidden])
Date: 2003-08-08 10:01:54

I'm lost with trying to use the (unreleased) program_options lib.

I have no problem to use with just command line, but I'd like to have both
command line and config file.

Here's what I tried:

  try {
    options_description desc("Allowed options");
      ("help", "", "produce help message")
      ("esNodB,e", parameter<double> ("value", &esnodB), "Es/No(dB)")
      ("maxBursts,m", parameter<int> ("value", &maxBursts), "stop after
      ("maxErrors,M", parameter<int> ("value", &maxErrors), "stop after

    options_and_arguments opts = parse_command_line(argc, argv, desc);
    variables_map vm;
    store(opts, vm, desc);

    ifstream ifs("TestUWP.cfg");
    options_and_arguments opts2 = parse_config_file(ifs, desc);
    variables_map cfg_file_vm;
    store(opts2, cfg_file_vm, desc);;

    if (vm.count("help")) {
      std::clog << desc << "\n";
      return 1;

  catch(std::exception& e) {
    std::cerr << "error: " << e.what() << "\n";
    return 1;

I get this message:
error: config file options should have required parameter

I tried various variations, and also referred to the multiple_sources example,
but I still can't find out what's wrong. Any clues?

Boost list run by bdawes at, gregod at, cpdaniel at, john at