boost-program-options

boost::program_options : how to declare and validate my own option type when it belongs to a namespace ?

Using boost::program_options, I can not get my own option type to compile when it is declared inside a namespace. However outside of the workspace it compiles and works fine : #include <boost/program_options.hpp> using namespace boost; using namespace boost::program_options; struct my_type1 { my_type1(int nn) : n(nn) {} int n; ...

"Multiple occurrences" exception for boost program_options

Hello, I am writing the following code on boost's program_options (version 1.42). This seems straight-forward and taken pretty much as is from the tutorial. However, I get a "multiple_occurrences" error. Further investigation discovers that it's (probably) the "filename" parameter that raises it. The parameters I am giving are: 3 1 te...

Problem linking when compliling the boost::program_options example

I am trying to compile the multiple_sources.cpp to compile on my computer. I am running Xubuntu Lucid Lynx fully updated. It will compile without issue with g++ -c multiple_sources.cpp but when I try to link and make an exectuable with g++ multiple_sources.o I get: multiple_sources.cpp:(.text+0x3d): undefined reference to `boost::progr...

boost program_options accept all values after last flag

Is there a way to collect all of the values after a specified argument with boost::program_options? There are two caveats that I need to take care of though, I need to accept unrecognized arguments, and I need to accept values that could contain dashes. I've tried playing around with command_line_parser vs parse_command_line and I can ge...

Using Boost.Program_options in modular program

The code I use consists of set of modules, compiled to individual libraries. Libraries in turn, are linked in different combinations to build different binaries. So for, it's pretty ordinal. Different modules use different command line arguments and I want to use Boost.Program_options for parsing. Since the set of command line argu...

Short options only in boost::program_options

How would one go about specifying short options without their long counterparts in boost? (",w", po::value<int>(), "Perfrom write with N frames") generates this -w [ -- ] arg : Perfrom write with N frames Any way to specify short options only? ...

Parsing positional arguments

Consider the following trivial program adopted from the boost program options examples #include <boost/program_options.hpp> #include <boost/version.hpp> #include <iostream> int main( int argc, char** argv ) { namespace po = boost::program_options; po::options_description desc("Options"); unsigned foo; desc.add_option...