Boost logo

Boost Users :

From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2005-11-20 15:04:38


I am using Boost 1.33.0 with MinGW on Windows XP. I am using the following program_optins code to collect command line arguments:

        po::options_description desc("Options");
        desc.add_options()
            ...[everyting defined in here works as advertised]...
        ;//add-options()

        // specify the single, required graph file positional parameter
        po::positional_options_description pd;
        pd.add("graph_file", 1);
        
        po::variables_map vm;
        po::store(parse_command_line(argc, argv, desc), vm);
        po::notify(vm);
        ...

The above code is shamelessly lifted from the tutorial. Everything defined in desc.add_options() works including the "-h" alternative to "--help". However, two things fail.

    * vm.count("graph_file") returns 0 regardless of whether there are positional argument(s).

    * specifying an -x, --xx, --xx=n option where "x" or "xx" is not included in desc.add_options() causes store() to not return (the program simply stops).

Am I missing something?

Merrill

    

    


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