Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:43:24+00:00 2026-06-13T23:43:24+00:00

I have trouble with boost::program_options . I have a piece of software composed of

  • 0

I have trouble with boost::program_options. I have a piece of software composed of several subcomponents, each one of which can declare some options to be passed on the command line. I would like to stick to the following flow:

  1. Configure boost::program_options with some options
  2. Match options
  3. Use matched options to initialize subcomponents
  4. Subcomponents constructors declare more options
  5. Match options again to configure components

So, at a certain instant of execution (2), I have only declared a number of options, but the program is actually called with the whole set of them (including the ones that will be declared in 3), causing a number of unrecognised option '...' errors. I can catch those, but the parsing will stop anyway. I have tried handling that with multiple options_description groups, I have also looked into command line styles (style_t) to see whether one of them allowed to ignore unmatched arguments. Do you have some more ideas?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:43:25+00:00Added an answer on June 13, 2026 at 11:43 pm

    Problem solved, sorry to bug you, but this could come handy to someone. Instead of using parse_command_line

    auto parsed = parse_command_line(argc, argv, opts);
    

    call command_line_parser‘s run method explicitly after calling allow_unregistered

    auto parsed = command_line_parser(argc, argv).options(opts).allow_unregistered().run();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some trouble reading from an ini file using boost program options. The
I have some trouble forward declaring a function that uses boost::enable_if : the following
I have trouble figuring out why a simple division like this one always returns
We have trouble implementing a nice session mechanism in JSP. One of our requirement
I have trouble where, for some reason, SVN would only merge the newly generated
I need to map a delete ptrAddr; to a boost::function0 but i have some
I have some troubles with using boost::locale (1.49) on Debian 7 GNU/Linux (version of
I have a class that accepts a list of policy classes using boost::mpl. Each
i'm having trouble packing a bunch of files into one archive. the boost docs
I have trouble getting boost:thread to work. It runs fine when compiling without optimization:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.