384 questions
1 vote
1 answer
157 views
Boost::program_options "option cannot be specified more than once" error when implementing a program with multiple modes
I am attempting to create a program with the following command line usage: test_program [General Options] <mode_1_option_1> <required_option_1> OR test_program [General Options] --toggle-...
2 votes
1 answer
116 views
Boost program_options: Mixing positional arguments and named arguments
I am using boost::program_options to make a simple executable with the following general syntax: program --command <cmd> [args] For example: program --command run --listen locahost --port 8080 ...
0 votes
0 answers
129 views
Homebrew libraries & CMake on MacOS Sonoma: ld does not find symbols despite correct specified architecture
Problem I am trying to port a C++ project from Linux to MacOs sonoma with the arm64 architecture. Configuring is done via CMAKE and the following toolchain GCC 14 from Homebrew HDF5 (installed via ...
1 vote
1 answer
127 views
Iterating over vectors created by Boost's program options in C++
I'm new to C++ and trying to use Boost's program_options header to create a vector<string> of positional options, but no matter what I do, I can't seem to actually do anything or iterate over ...
1 vote
1 answer
317 views
Catching exceptions from boost::program_options
Stupid question (but I don't find anything on boost.org): how do I catch exceptions from boost::program_options? Invoking #include <boost/program_options.hpp> #include <iostream> int main(...
0 votes
0 answers
42 views
C++: std::unique_prt + boost -- undefined reference in make_unique [duplicate]
ladies and guys! When I was writing my application I started writing a settings class: Config.h: #ifndef CONFIG_H #define CONFIG_H #include <iostream> #include <fstream> #include <...
1 vote
2 answers
274 views
Boost program_options cannot parse uint8 vector argument
I am learning boost through examples, but I do not understand why the following c++ code failed to execute, I am only changing int to uint8_t, am I missing anything? #include <stdint.h> #include ...
0 votes
1 answer
51 views
Boost.program_options silently fails only after adding positional option to the parser
I am trying to use Boost.program_options, but positional arguments do not work. I am a newbie at this. #include "Application.h" #include <iostream> #include <vector> #include &...
1 vote
1 answer
127 views
Using '[' and ']' with boost::program_options
I am using boost add_options() like this way:
("setclient", po::value<std::string>(), "<awsipaddress>[:awsport[:mystring]] Change the settings.") This works well if I ...
1 vote
1 answer
143 views
Expect a specific order of the provided CLI arguments using boost program_options
Let's assume we have the following boost::program_options-specific options description: po::options_description main_desc("Usage: my_app [--version] OBJECT { COMMAND | --help }\n" ...
0 votes
1 answer
313 views
boost::program_options option of type std::optional<string> will not compile
The line attempting to add_options() of type std::optional<string> results in a compile error. does boost::program_options not support this type? how are optional options managed w/ boost::...
2 votes
0 answers
126 views
boost::program_options conditionally required option
My executable has two modes of operation which are selectable via --mode=foo or --mode=bar. If mode=foo, then --abc option should be required and --xyz should not be specified. If mode=bar, then --xyz ...
1 vote
1 answer
289 views
Boost::program_options how to parse multiple multi_tokens
is it possible to parse multiple mulit-token parameters with the same name? Like: program.exe --param a b c --param foo bar ? I only could get it to work like this: program.exe --param "a b c&...
0 votes
1 answer
123 views
Single-token and multi-token positional options with boost::program_options
I am writing a program that would receive as parameters a filename followed by multiple strings. Optionally it could take a -count argument; ./program [-count n] <filename> <string1> <...
2 votes
1 answer
522 views
What's the best way to pass an empty string as argument to boost::program_options?
I have a program that use boost::program_options to parse a command line. One of the parameter is the name of an AMQP exchange, and a default value is provided. For testing purposes, I would like to ...