Boost logo

Boost :

From: Allen Bierbaum (allenb_at_[hidden])
Date: 2004-11-23 11:43:38


I have recently started using the program_options library, and I find it
very useful. Unfortunately I can't seem to figure out how to allow it
to work with other option parsers/handlers at the same time.

For example, right now I am writing an application that uses a library
that has its own set of common options that are process internally. So
I end up needing to write code similar to the following:

po::options_description desc("Allowed options");
desc.add_options()
    ("help", "produce help message")
    ("my_opt", po::value<int>(), "set my option")
;

po::variables_map vm;
po::store(po::parse_command_line(ac, av, desc), vm);
po::notify(vm);

custom_lib::options opts;
opts.process(ac, av);

Then when I run this application:

./app --my_opt=10 --liboption=custom

The problem is that I get an exception from program_options:

error: unknown option --liboption

Is there any way to tell the program options parser to ignore options
that it does not recognize? If there is no option like this, how can
program_options be used with other option parsers?

-Allen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk