Boost logo

Boost Users :

From: James E Taylor (james_at_[hidden])
Date: 2005-03-30 11:16:30


boost-users,

I am trying to use multitoken arguments with MS Visual C++ 6.

The problem is my multitoken option description is not being recognised, so when I run the program with more than one token after the --multi flag, I get an exception.

A minimalist program is below. Please note the necessary hack of providing 5 args to po::parse_command_line, which I have to do to satisfy the vc6 compiler.

I'm linking with

libboost_program_options-vc6-sgd.lib

Any help would be much appreciated.

Thanks,
James

int main(int argc, char* argv[])
{
  po::options_description desc("Allowed options");
  try {
    desc.add_options()
      ("multi", po::value<string>()->multitoken(), "multi token argument")
    ;
    po::variables_map vm;
    /* next line, have to pass 5 args to parse_command_line: seems to be */
    /* a compiler problem in vc6 */
    po::store(po::parse_command_line(argc, argv, desc, 0, po::ext_parser()), vm);
    po::notify(vm);
    cout << "parsed successfully" << endl;
  }
  catch ( const std::exception &e ) {
    cerr << e.what() << endl << desc << endl;
    return -1;
  }
  return 0;
}

-- 
James E Taylor
___________________________________
NOCC, http://nocc.sourceforge.net

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net