boost-program-options Questions

1

I'm struggling to get boost program options to work properly. I need to be able to start my program from the terminal window (Linux) with an optional argument that takes a value. No matter what I d...
Mello asked 19/5, 2016 at 18:57

3

Solved

I need to be able to have boost::program_options parse an array of doubles that are passed on a command line. For positive doubles, this is no problem, of course (use multitoken with std::vector&lt...
Lathrope asked 5/11, 2010 at 14:57

2

Solved

In the boost::program_options library, I cannot understand how to allow the user to pass a parameter which has not been added through add_options(). I would like it to be just ignored, instead of t...
Faires asked 21/3, 2013 at 15:55

1

Solved

I'm trying to parse command line with boost 1.58.0. My code is quite simple and copy\pasted from the tutorials. It looks like that: try { po::options_description desc; desc.add_options() ("ver...
Jimmiejimmy asked 26/10, 2015 at 12:7

2

Using bool_switch, I can write a command line option to turn a flag on: bool flag; po::options_description options; options.add_options() ("on", po::bool_switch(&flag)->default_value(fals...
Kohlrabi asked 16/10, 2015 at 13:33

1

Solved

I am using the Boost program option and I want to offer an option which has three ways: If not define If defined but no value If defined with a value For example, I have a program that works ...
Bertabertasi asked 10/8, 2015 at 13:44

1

I'm developing an update in an existing program. I'm replacing Posix's getopt_long() with boost::program_options. But my work doesn't work as I should: I want to have read arguments like: -server=...
Jillene asked 24/12, 2014 at 11:22

3

Solved

Is it possible to set minimum and maximum limit of a value (suppose it is unsigned short and I need a value between 0 and 10) as I can set default value by opt::value<unsigned short>()->d...
Pyrrhuloxia asked 28/8, 2014 at 11:50

3

Solved

One can use notifier for parsed options only if they have value_semantic. What is the best way for no-value options to be automatically handled by the given notifier? The simple approach is to ma...
Rhodos asked 24/8, 2011 at 11:36

2

I would like to reload some values from a configuration file. I know that po::store will not change values if they exist in the variables_map. Is there an alternative that does replace values even ...
Bultman asked 3/12, 2011 at 22:10

4

I have recently started to use boost::program_options and found it to be highly convenient. That said, there is one thing missing that I was unable to code myself in a good way: I would like to it...
Harijan asked 3/9, 2012 at 8:22

2

Solved

The weird thing to me is, that boost's options_description uses multi-line code without backslash or semicolon or comma. I did a little research, but found nothing. (Code taken from official boost...
Mor asked 29/7, 2014 at 11:30

1

Solved

I'm using boost::program_options to parse the command line for my program and am having trouble trying to read a value into a public enum in a class which is also in a namespace. Specifics: Boost...
Karolinekaroly asked 19/6, 2014 at 15:12

1

Solved

With command line options, I can do the following: po::variables_map vm; auto parsedOptions = po::command_line_parser(argc, argv).options(optionsDescription1).allow_unregistered().run(); po::store...
Rosecan asked 14/5, 2014 at 20:28

2

Solved

I need to implement an optional flag, say -f/--flag. Since this is a flag, there is no value associated. In my code I only need to know whether the flag was set or not. What's the proper way to do ...
Crossrefer asked 16/5, 2014 at 20:17

1

Solved

My program (prog.exe) supports the following four flags: -P, -p , -b and -s. However: -b and -p must be specified together, constitute a set, and have numeric values e.g. -b 42 -s cannot be speci...
Roney asked 22/3, 2013 at 18:7

1

Solved

I have the following sample code: #include <iostream> #include <boost/program_options.hpp> int main ( int ac, char *av[] ) { // Declare the supported options. boost::program_options...
Ecchymosis asked 1/11, 2013 at 14:43

3

Is there a way to set an allowed set of input variables for parameters? For example parameter "arg" can have only string values like "cat" and "dog".
Fester asked 11/1, 2012 at 13:30

1

Solved

The boost option parser allows one to assign a variable to store the option value, instead of using the so_long["typing"].as<bool>() way: bool flag_value; entries.add_options() ("flag", valu...
Latishalatitude asked 25/7, 2013 at 9:22

1

I recently discovered an undocumented feature of boost::program_options, namely that it accepts "*" as a special wildcard that allows declaration of a group of options with the same prefix, like th...
Snailfish asked 17/1, 2013 at 16:54

1

Solved

I am using Boost Program Options to parse command line arguments (and I don't want to miss it since it works great). However, I have one problem: Boost program options offer the possibility to assi...
Czarevna asked 5/6, 2013 at 9:11

2

Solved

I am using Boost::Program_options to parse my command line and adapted some code from the tutorial as following: try { po::options_description desc("Allowed options"); desc.add_options() ("hel...
Mitchel asked 14/5, 2013 at 21:10

3

Solved

I would like to pass the multiple arguments with positive or negative values. Is it possible to parse it? Currently I have a following initialization: vector<int> IDlist; namespace po = boo...
Broome asked 29/3, 2010 at 15:20

4

Solved

I would like to use boost::program_options to create an executable which can be called as follows: ./example --nmax=0,10 # nmax is chosen randomly between 0 and 10 ./example --nmax=9 # nmax is set...
Struve asked 16/4, 2012 at 14:28

1

Solved

Is it possible to use parameters of this kind with boost::program_options? program -p1 123 -p2 234 -p3 345 -p12 678 i.e., is it possible to specify the parameter name with a first token (e.g. -...
Droppings asked 21/3, 2013 at 18:1

© 2022 - 2024 — McMap. All rights reserved.